Test a node-cron schedule.
Paste the string you pass to cron.schedule(). The tester runs node-cron’s own parser and matcher (version 4.6.0, copied unchanged from the npm package), so the errors and the next run times are exactly what your app will get.
How node-cron reads a schedule.
| Fields | 5 or 6. With 6, the first is seconds (0-59). |
| Day of week | 0-7, where 0 and 7 are Sunday; names such as mon or monday work. |
| Day of month and day of week | Combined with AND: both must match. Unix cron uses OR. |
| Extras | L, L-3, 15W, LW (day of month); 5L, 2#3 (day of week); ? as an alias for *; @daily-style nicknames. |
| Reversed ranges | 22-2 wraps round: hours 22, 23, 0, 1, 2. |
| Time zone | timezone option (IANA name); default is the process time zone. |
node-cron’s own parser and matcher are copied unchanged from the npm package (version 4.6.0); a test run compares them with the installed package on 8,000 schedule/time-zone pairs (0 differences). Last checked 18 November 2026.
Run a cron job in Node.js
Install node-cron and schedule a function. The task runs inside your Node.js process for as long as it keeps running:
npm install node-cron
import cron from 'node-cron';
const task = cron.schedule('*/5 * * * *', () => {
console.log('runs every 5 minutes');
}, { timezone: 'America/New_York', noOverlap: true });
// task.stop(); pause
// task.start(); resume
// task.destroy(); remove
Paste the schedule string into the tester above to check it before you deploy.
Or let the server's cron start a script. If the job shouldn't depend on a long-running process, add a crontab line that runs a Node script. Use the full path to node (find it with command -v node), because cron's PATH is only /usr/bin:/bin and nvm's shell setup isn't loaded:
*/5 * * * * /home/alice/.nvm/versions/node/v22.11.0/bin/node /home/alice/app/job.js >> /home/alice/app/job.log 2>&1
That line uses Unix cron rules (day fields OR'd, no seconds field), which differ from node-cron's; see what is cron and where cron logs go.
The surprise: 0 0 13 * 5 is Friday the 13th
In Unix cron, a day of the month and a day of the week are combined with OR, so 0 0 13 * 5 runs on every 13th and every Friday. node-cron combines them with AND: the README says both must match. The same line therefore runs only on Fridays that fall on the 13th, which is once or twice a year. If you copied a crontab line that relies on OR, split it into two schedules.
Seconds, and the six-field form
node-cron adds a seconds field at the front when you give six fields; with five fields it runs at second 0. */10 * * * * * fires every 10 seconds. Be careful with copied Quartz expressions: node-cron borrows L, W, # and ? from Quartz but numbers weekdays like Unix cron (1 = Monday), while Quartz uses 1 = Sunday.
Things node-cron does that the server never sees
- Schedules live in memory. node-cron does not persist state, so runs that fall while your process is stopped are not made later.
- Options in version 4 include
noOverlap(skip a run while the previous one is still running),maxExecutions,nameanddistributedcoordination across instances. - Times follow the
timezoneoption, or the time zone of the Node process if you leave it out.
Sources: node-cron README (v4.6.0) · node-cron on npm · nodecron.com documentation
Related: Daylight saving time checker · Crontab file checker · All platform tools
node-cron FAQs.
Install node-cron (npm install node-cron), then call cron.schedule('*/5 * * * *', () => { ... }) in a process that keeps running. To run a script from the server instead, add a crontab line with the full path to node, because cron does not load your shell or nvm settings.
Yes. Give six fields and the first one is seconds (0-59), for example */10 * * * * * runs every 10 seconds. With five fields node-cron runs at second 0.
node-cron combines day-of-month and day-of-week with AND, so both have to match. Unix cron uses OR and would run on every 13th and every Friday.
Both. node-cron accepts 0-7 and treats 0 and 7 as Sunday. Names such as sun or sunday also work.
Pass the timezone option: cron.schedule(expr, fn, { timezone: 'America/New_York' }). Without it, node-cron uses the time zone of the Node.js process.
Version 4 does: L, L-n, nW and LW in day-of-month, nL and n#k in day-of-week, and ? as an alias for *. Weekday numbers still follow Unix cron (1 = Monday), not Quartz.