Cron expression tester for .NET
Type an expression and pick the library that will read it. The next run times come from a port of that library's rules, checked against the library itself.
Fields in each format
| Library | Fields | Day of week | Extras |
|---|---|---|---|
| NCrontab (5) | minute hour day month day-of-week | 0–6, 0 = Sunday, or SUN–SAT | lists, ranges, */n, a/n |
| NCrontab with seconds (Azure Functions) | second minute hour day month day-of-week | 0–6, 0 = Sunday | as above |
| Cronos (Hangfire) | [second] minute hour day month day-of-week | 0–7, 0 and 7 = Sunday | L, L-n, nW, LW, 5L, 1#2, ?, @daily and other macros |
| Quartz.NET | second minute hour day month day-of-week [year] | 1–7, 1 = Sunday, or SUN–SAT | L, L-n, nW, LW, 6L, 2#1, ?, year field |
Hangfire Cron helpers
The strings Hangfire's Cron class returns (Hangfire.Core 1.8.25.0):
| Call | Expression |
|---|---|
| Cron.Minutely() | * * * * * |
| Cron.Hourly() | 0 * * * * |
| Cron.Hourly(15) | 15 * * * * |
| Cron.Daily() | 0 0 * * * |
| Cron.Daily(9) | 0 9 * * * |
| Cron.Daily(9, 30) | 30 9 * * * |
| Cron.Weekly() | 0 0 * * 1 |
| Cron.Weekly(DayOfWeek.Friday, 17) | 0 17 * * 5 |
| Cron.Monthly() | 0 0 1 * * |
| Cron.Monthly(15) | 0 0 15 * * |
| Cron.Yearly() | 0 0 1 1 * |
| Cron.Never() | 0 0 31 2 * |
Common schedules
- Every minute
- Every 5 minutes
- Every 10 minutes
- Every 15 minutes
- Every 30 minutes
- Every hour
- Every 2 hours
- Every day at midnight
- Every day at 9am
- Every weekday at 9am
- Every Monday at 9am
- Every Sunday at midnight
- First day of every month at midnight
- Last day of every month at midnight
- Every 10 seconds
- Never (a schedule that doesn't fire)
Checked against NCrontab 3.4.0.0, Cronos, Quartz.NET 4.7.3.0 and Hangfire 1.8.25.0: every example and test expression gives the same next run times as the library.
Questions
What format does an Azure Functions timer trigger use?
NCrontab with six fields: {second} {minute} {hour} {day} {month} {day-of-week}. Pick “NCrontab with seconds” above. Microsoft’s timer trigger documentation says five-field expressions are supported too; pick “NCrontab (5 fields)” for those.
Why does “0 0 13 * 5” only run on Friday the 13th?
In NCrontab and in Cronos (Hangfire), a day of month and a day of week must both match, so the expression fires only when the 13th is a Friday. Quartz.NET fires when either matches. Checked against NCrontab 3.4.0.0, Cronos and Quartz.NET 4.7.3.0.
Is Sunday 0 or 7?
NCrontab accepts 0–6 only (7 is an error). Cronos accepts both 0 and 7. Quartz.NET numbers days 1–7 with 1 = Sunday, so MON is 2; using names (SUN, MON…) avoids the mix-up.
What does Hangfire’s Cron.Never() produce?
0 0 31 2 *: 31 February, which never exists, so the job only runs when triggered by hand.
What does “?” mean?
“No specific value”. Quartz.NET uses it in the day-of-month or day-of-week field; Cronos accepts it as “*”. NCrontab rejects it.
Which time zone are the run times in?
UTC, plus the same instants in your browser’s time zone. Azure Functions uses UTC unless the app setting WEBSITE_TIME_ZONE is set (Microsoft’s timer trigger documentation); Hangfire and Quartz.NET can be given a time zone too, which shifts the clock times.
More tools
- appsettings.json ⇄ environment variables
- SQL Server connection string builder
- PostgreSQL connection string builder
- DateTime format string tester
- TimeSpan format string tester
- JSON to C# records
Runs in your browser: nothing you paste is sent anywhere. Not affiliated with Microsoft, the .NET Foundation or the library authors.