Cron name aliases: JAN to DEC and SUN to SAT
Two fields accept names instead of numbers: the month field takes JAN through DEC and the day of week field takes SUN through SAT. Both are case insensitive.
At a glance
- Fields that accept names
- Month and day of week only.
- Month names
- JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC.
- Day names
- SUN, MON, TUE, THU, FRI and SAT are accepted. WED is not, because of the check on the letter W.
- Case
- Insensitive. mon, Mon and MON are the same token.
- In ranges and lists
- Allowed. MON-FRI and JAN,APR,JUL,OCT both parse.
- In steps
- Allowed as a start value, so JAN/3 means start at January and step by three.
In detail
Only two of the six possible fields have names. The month field maps JAN through DEC to 1 through 12, and the day of week field maps SUN through SAT to 0 through 6. The minute, hour, day of month and seconds fields take numbers only, and a name there is rejected as an invalid value.
The parser lowercases a token before looking it up, so capitalisation is irrelevant and MON, Mon and mon are the same. Only the three letter form is recognised: the full word January and the abbreviated Jan. with a full stop both fail, because the lookup is an exact match against the short names.
Names work anywhere a number would, which is more places than people expect. They can be either end of a range, so MON-FRI and JAN-MAR are valid. They can be elements of a list, so MON,FRI parses. They can even be the start value of a step, so JAN/3 gives January, April, July and October.
Whether to use them is a readability question. 1-5 and MON-FRI produce identical schedules, but only one of them makes the reader remember that the week starts on Sunday. For any expression a human will have to review later, names are usually worth the extra characters, and mixing the two styles in one crontab is the option to avoid.
Examples
0 9 * * MON-FRIIdentical to 0 9 * * 1-5.
0 0 1 JAN,APR,JUL,OCT *Identical to 0 0 1 1,4,7,10 *.
0 0 1 FEB/3 *February, May, August and November.
Things that catch people out
- WED is the one abbreviation this parser refuses, because the field is screened for the Quartz character W before names are resolved. Use 3 for Wednesday.
- Only the three letter abbreviations work. Full month names and names with a full stop are rejected.
- The minute, hour and day of month fields have no names at all. There is no shorthand for midnight or for the end of a month.
- Names do not change the OR rule. MON in the day of week field alongside a day of month restriction still triggers it.
Try it: Cron Expression Parser
Paste any five or six field expression to get a plain English description, a per field breakdown and the next run times in your local time.
Cron Expression Parser
LOCAL · Browser-OnlyParse cron expressions and see the next scheduled run times
Supports 5-field (minute hour day month weekday), 6-field (with seconds), named values (JAN, MON), and @macros (@daily, @hourly, ...)
Use the dropdowns below to build your cron expression visually, or type a custom value in each field.
Human-Readable Description
Every 5 minutes
Field Breakdown
| Field | Allowed | Value | Meaning |
|---|---|---|---|
| Minute | 0-59 | */5 | every 5 minute(s) |
| Hour | 0-23 | * | every hour |
| Day of Month | 1-31 | * | every day of month |
| Month | 1-12 | * | every month |
| Day of Week | 0-7 | * | every day of week |
Related cron expressions
All cron expressions →The cron month field: 1 to 12 with JAN to DEC aliases
The month field runs 1 to 12 and also accepts the three letter names JAN through DEC, case insensitively, including inside ranges and steps.
The cron day of week field: 0 to 7 with Sunday at both ends
The day of week field runs 0 to 7 with Sunday as both 0 and 7, and accepts SUN through SAT. Restricting it changes how the day of month field behaves.
The cron comma: listing several values in one field
A comma joins several values into one field, and each element can itself be a value, a range or a step. Spaces inside a list break the expression.
The cron hyphen: inclusive ranges and why they cannot wrap
A hyphen range includes both ends, so 9-17 is nine values. The start must not be greater than the end, which is why 22-6 is rejected.
Cron macros: @daily, @weekly, @monthly and the rest
Seven macros expand to ordinary five field expressions, and @reboot has no scheduled time at all. Here is exactly what each one becomes.
Cron L, W, # and ?: the Quartz characters this parser rejects
The Quartz extensions L, W, # and ? are rejected here with a named error. What each one means in Quartz, and what to write in standard cron instead.
Tools for this
- Cron Expression Parser Free online cron expression parser - parse cron expressions and see the next scheduled run times
- Crontab Generator Free online crontab generator - build cron expressions visually with an intuitive interface