Facebook Pixel

What is a cron expression format?

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).

Verify This Answer

Cross-check this information using these trusted sources:

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?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.