opyebCronPulse

Cron special characters: *, /, -, commas, ?, L, W and #

Cron basics · 6 min read

One-line answer: The eight symbols that make cron expressive, what each one means, and where implementations disagree.

Most of cron's power sits in its special characters. On the same field, * and */15 produce wildly different run counts. The table below covers what Unix cron and the Quartz family share.

SymbolMeaningExampleResult
*Every value* * * * *Every minute
,List0 9,18 * * *09:00 and 18:00
-Range0 9-17 * * *Every hour from 09:00 to 17:00
/Step*/10 * * * *Every ten minutes
?No specific value (Quartz)0 0 12 ? * MONDay of month unspecified
LLast (Quartz)0 0 L * *Last day of the month
WNearest weekday (Quartz)0 9 15W * *Weekday nearest the 15th
#Nth weekday (Quartz)0 9 ? * 2#1First Monday
0 9 1,15 * *     the 1st and 15th at 09:00
0 9-18/3 * * *   09:00, 12:00, 15:00, 18:00
0 0 L * *        last day of the month
0 9 ? * 2#1      first Monday (Quartz)

The step depends on its starting point

*/15 starts at zero, so it runs at 0, 15, 30 and 45 minutes. 5/15 starts at five and runs at 5, 20, 35 and 50. When someone asks for “every 15 minutes” and writes 5/15, the job drifts away from every other hourly job. Unless the offset is deliberate, */15 is the safer choice.

L and W belong to Quartz

Unix cron does not support L, W or #. Quartz, Spring's @Scheduled and some cloud schedulers do. 15W runs on the 15th, or on the Friday before if the 15th is a Saturday, or the Monday after if it is a Sunday. It is useful for month-end work that must land on a business day, but it does not know about public holidays.

Weekday numbers differ by product

Quartz and AWS EventBridge number Sunday as 1 through Saturday as 7, while Unix cron numbers Sunday as 0. The same 2 means Tuesday in Unix and Monday in Quartz. Names such as MON avoid the problem entirely. CronPulse applies the Quartz numbering when it reads six- and seven-field expressions.

Read in two blocks

Do not read a complex expression left to right. Split it into “when” (minute, hour) and “which day” (day, month, weekday). 30 2 * * 1-5 is “02:30 on weekdays”. 0 0 1,15 * * is “midnight on the 1st and 15th”. That habit prevents most misreadings.

Paste an expression and see its next run times right away.

Open CronPulse

Frequently asked questions

Are `*/5` and `0-59/5` the same?

Yes. * covers 0–59, so */5 selects 0, 5, 10, …, 55 exactly as 0-59/5 does.

How is `?` different from `*`?

The run times are usually identical, but the meaning differs. * says “every value”; ? says “this field is unspecified”. Quartz requires one of day-of-month or day-of-week to be ?.

Sources

Related reading