Five fields: minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-7). Examples: */15 * * * * (every 15 min), 0 0 * * * (daily midnight), 0 9 * * 1-5 (weekdays 9 AM), 0 0 * * 0 (Sundays at midnight).
What is a cron expression format?
More FAQs in What Are Cron Jobs and Why Use Them in Node.js Scheduled Tasks Guide
A cron job is a scheduled task that runs automatically at fixed intervals using a cron expression (minute hour day month weekday). Examples: 0 0 * * * (daily at midnight), */15 * * * * (every 15 minutes), 0 9 * * 1-5 (weekdays at 9 AM). Used for cleanup, notifications, backups, and reports.
Install node-cron (npm install node-cron), then use cron.schedule('0 0 * * *', () => { ... }) to run a task daily at midnight. The cron expression specifies when to run, and the callback is the task to execute.
Cron uses human-readable expressions (0 0 * * * for daily at midnight) and can handle complex schedules (weekdays at 9 AM). setInterval uses milliseconds and is lost on restart. Use cron for daily/weekly tasks, setInterval for short intervals.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.