Cron tools › Platforms
node-cron expression tester
Type the expression you pass to cron.schedule(). See it read the way node-cron reads it — seconds first when
there are six fields, day of month AND day of week — with the next runs in the task's timezone and node-cron's documented
daylight-saving rule, then copy the code.
Next runs
Code
Try one
How to test a node-cron schedule
- Type the expression. Five fields start at the minute (seconds default to 0); six fields start at the second.
- Set the timezone option you will pass, or leave it unset to use the server's zone — the runs then use this browser's zone as a stand-in.
- Read the meaning and the warnings. If Linux cron would read the same text differently, the page says how.
- Check the next runs. Runs that node-cron skips at a daylight-saving change are struck through.
- Copy the
cron.schedule()call. Turn on noOverlap if a run can take longer than the gap to the next one.
node-cron syntax compared with Linux cron
| node-cron 4.x | Linux cron (Vixie / cronie) | |
|---|---|---|
| Fields | 5, or 6 with a leading seconds field | 5 |
| Day of month and day of week both set | Both must match (AND) | Either matches (OR) |
| Day of week | 0-7, 0 and 7 = Sunday | The same |
| Names | Full or short: January, Jan, Sunday, Sun | First three letters |
| Last day / nearest weekday | L, L-3, 15W, LW | None |
| n-th / last weekday | 2#3 (third Tuesday), 5L (last Friday) | None |
? | Same as *, day fields only | Not in crontab(5) |
| Backwards range | Wraps: 22-2 = 22:00 to 02:59 | Not in crontab(5): write 22-23,0-2 |
| Shorthands | @yearly, @annually, @monthly, @weekly, @daily, @midnight, @hourly; no @reboot | The same plus @reboot |
The AND rule changes the classic "first Monday of the month": 0 9 1-7 * 1 is exactly that in node-cron, but in Linux cron it
runs on the 1st to the 7th and on every Monday. 0 0 1 * 1 in node-cron runs only when the 1st is a Monday.
node-cron borrows L, W, # and ? from Quartz but is not Quartz-compatible: in Quartz
1 = Sunday, in node-cron 1 = Monday. L-3 counts three days back from the last day, so it is the 28th of a 31-day month.
To move a schedule between these libraries, use cron to code.
Time zones and daylight saving time
node-cron matches the expression against the wall clock of the task's timezone, or the system zone when the option is not
set. Its documentation describes daylight-saving changes precisely: a time inside the skipped hour is skipped (a daily
30 2 * * * does not run on the spring-forward day, and */15 resumes at 03:00), and in a repeated hour it
"fires on the first occurrence and ignores the second", so an every-15-minutes task pauses for the length of the shift.
We ran node-cron 4.6.0 against that rule. In zones behind UTC — New York, Chicago, Los Angeles, Santiago — it behaved as documented.
In zones ahead of UTC — London, Berlin, Kyiv, Sydney, Lord Howe, Auckland — it fired the second occurrence and skipped the first
pass: 30 2 * * * in Europe/Berlin on 31 October 2027 ran at 02:30 CET, not 02:30 CEST. The run list follows the documented
rule and marks repeated-hour runs in those zones. To avoid the question entirely, pass a zone without DST such as Etc/UTC;
the DST checker lists every affected run for a year.
FAQ
Why does my node-cron task run every second?
With six fields the first is seconds, so * * 9 * * * runs every second of the 09:00 hour. Use
0 9 * * * (five fields) or 0 0 9 * * * (six fields) for once at 09:00.
Does node-cron OR the day of month and day of week like crontab?
No. node-cron requires both to match. 0 0 1 * 1 runs only on a 1st that is a Monday, where Linux cron would run on every
1st and every Monday.
How do I check an expression in code?
cron.validate(expression) returns true or false. node-cron 4 also has
validateDetailed(), which lists every problem with its field.
What happens if a run is still going when the next one is due?
By default node-cron starts the next run anyway. With noOverlap: true the new run is skipped instead, and the task emits
an execution:overlap event.