Free Node.js cron expression builder. Generate ready-to-use code for node-cron, cron (CronJob), node-schedule, and Bree — with timezone support. Compare the top 4 Node.js cron packages to pick the right one for your project.
0 9 * * 1-5const cron = require('node-cron');
// Schedule: Runs at minute 0 at 9:00 AM
cron.schedule('0 9 * * 1-5', () => {
scheduledTask();
}, {
timezone: 'Asia/Kolkata'
});
function scheduledTask() {
console.log('Running at:', new Date().toISOString());
// Your task logic here
}// ESM / ES Modules version (node-cron)
import cron from 'node-cron';
cron.schedule('0 9 * * 1-5', () => {
console.log('Running:', new Date().toISOString());
}, { timezone: 'Asia/Kolkata' });For most projects: node-cron (simple, zero deps) or cron/CronJob (TypeScript-friendly, timezone built-in). Use node-schedule if you need date-based scheduling beyond cron syntax. Use Bree if you want worker thread isolation so crashed jobs don't affect your main process.
Pass a timezone option: cron.schedule("0 9 * * *", fn, { timezone: "Asia/Kolkata" }). Valid values are IANA timezone names like "UTC", "America/New_York", or "Asia/Kolkata".
const task = cron.schedule(...); task.stop(); — stops future executions. task.destroy(); — permanently removes the task. Store the returned object to control the job later.
node-cron supports a 6th field for seconds: cron.schedule("*/5 * * * * *", fn) runs every 5 seconds. Not all packages support this — check your package's documentation.
Cron jobs defined in code don't persist — they restart with the process. For persistence, use a database-backed queue (Bull, BullMQ) or a dedicated scheduler like Agenda. For simple cases, use PM2 to keep the process alive.
npm install node-cron