An open API service indexing awesome lists of open source software.

https://github.com/thomasardal/norc

Get a CRON expression from a human-readable string
https://github.com/thomasardal/norc

cron cron-expression cron-job cron-jobs cronjob

Last synced: about 2 months ago
JSON representation

Get a CRON expression from a human-readable string

Awesome Lists containing this project

README

          

[![Build status](https://github.com/ThomasArdal/norC/workflows/build/badge.svg)](https://github.com/ThomasArdal/norC/actions/workflows/build.yml)
[![NuGet](https://img.shields.io/nuget/v/norC.svg)](https://www.nuget.org/packages/norC)

# norC

Get a CRON expression from a human-readable string.

## Installation

```
dotnet add package norC --prerelease
```

## Usage

```csharp
CronExpression cron = CronExpression.FromHumanString("Every day at 3 PM");
Console.WriteLine(cron); // output: 0 15 * * *

// or

CronExpression cron = "Every month".AsCron();
Console.WriteLine(cron); // output: 0 0 1 * *
```

### Options

```csharp
CronExpression cron = "Every second".AsCron(new CronOptions { IncludeSeconds = true });
Console.WriteLine(cron); // output: * * * * * *
```