Home โบ Cron โบ node-cron
node-cron Expression Generator & Tester
node-cron schedules tasks in Node.js with a cron string. Unlike classic crontab it accepts an optional leading seconds field, and it requires day-of-month and day-of-week to both match. Type an expression to see what it means and when it fires.
Your week at a glance
Upcoming runs
| # | Local | UTC | From now |
|---|
Copy-ready code
What to know about node-cron cron
- Five fields (minute, hour, day-of-month, month, day-of-week) run at second 0. Add a sixth field at the front for seconds.
- Day-of-month and day-of-week must both match, unlike Unix cron which fires on either. That makes
0 9 1-7 * 1exactly "the first Monday of the month". - Weekdays are 0-7 with Sunday as 0 or 7, and month and weekday names are accepted.
?is accepted as an alias for*in the day fields. - The current node-cron documentation lists
L,Wand#in the day fields. Older releases may not support them, so check your installed version. - Pass
{ timezone: "Asia/Kolkata" }to evaluate in a zone. The documentation recommendstimezone: "UTC"for jobs that must not skip or repeat across daylight saving changes.
Common node-cron schedules
Ready-made expressions for the schedules people search for most. Each page explains the expression and shows the first run times.
Frequently asked questions
Does node-cron support seconds?
Yes. The first field is an optional seconds field, so */10 * * * * * runs every ten seconds. With five fields the task runs at second 0.
Why does my schedule rarely run?
Because node-cron ANDs the day fields. 0 10 1 * 1 means "the 1st AND a Monday", which happens only a few times a year. Leave one of the day fields as *.
How do I run something on the first Monday of the month?
Use 0 9 1-7 * 1: days 1 to 7, and Monday. Because both must match, only the first Monday qualifies.
Moving a schedule between systems? Use the cron format converter, or read the cron error fixes.