DD
DevDash

Cron Expression

Format

Definition

A cron expression is a string of 5-6 fields defining a recurring schedule for automated tasks. Cron is the Unix job scheduler; cron expressions are also used in cloud functions, CI/CD pipelines (GitHub Actions), and backend frameworks to schedule periodic jobs.

Cron Field Reference and Syntax

A standard cron expression has five fields in order: minute (0-59), hour (0-23), day of month (1-31), month (1-12 or JAN-DEC), and day of week (0-7, where both 0 and 7 represent Sunday, or SUN-SAT). Each field accepts several value types: a specific number (5), a wildcard * meaning every valid value, a comma-separated list (1,15,30), a range using a hyphen (1-5), a step value using a slash (*/5 means every 5th value in the valid range), or a combination (1-5/2 means 1, 3, 5). Some implementations extend this with a 6th field for seconds placed before the minute field, or an optional year field placed after day of week. Quartz Scheduler for Java uses 6 mandatory fields (seconds, minutes, hours, day, month, weekday) plus an optional year. AWS EventBridge uses slightly different syntax, requiring ? instead of * for day fields when the other day field is already specified. Vercel cron jobs use the standard 5-field format. GitHub Actions uses standard 5-field cron but enforces a minimum interval of 5 minutes between runs.

Common Cron Expression Examples

Run every minute: * * * * *. Every 5 minutes: */5 * * * *. Every hour exactly on the hour: 0 * * * *. Daily at midnight UTC: 0 0 * * *. Daily at 9:30 AM: 30 9 * * *. Every weekday at 8 AM: 0 8 * * 1-5. Every Monday at noon: 0 12 * * 1. First day of every month at midnight: 0 0 1 * *. Last day of the month is not directly supported in standard cron, so a common workaround is to schedule for days 28-31 and have the script check whether tomorrow is the 1st. Every 15 minutes during business hours on weekdays: */15 9-17 * * 1-5. At midnight on January 1st (New Year): 0 0 1 1 *. When debugging a cron schedule, use DevToolHQ's cron expression parser or the crontab.guru website to validate the expression and preview upcoming run times before deploying to production.

Cron Expression Differences Across Platforms

Standard Unix cron uses 5 fields and does not support seconds: 0 9 * * 1 runs at 9 AM on Mondays. Vercel cron jobs use the same 5-field standard defined in vercel.json under the crons array. GitHub Actions schedule triggers also use 5-field cron but run in UTC and enforce a minimum interval of 5 minutes despite the syntax allowing * * * * *. AWS EventBridge requires ? in unused day fields: cron(0 9 ? * MON *) runs at 9 AM every Monday. Node.js with the node-cron library supports both 5-field and 6-field expressions with optional seconds: cron.schedule('0 9 * * 1', callback). Kubernetes CronJob uses the standard 5-field format in spec.schedule. Key differences to watch for: day-of-week numbering varies between systems where 0 and 7 both mean Sunday on some systems but 1 means Monday on others. Timezone handling is the most common source of bugs since most schedulers default to UTC. Specify a TZ environment variable or a timezone parameter for local time scheduling. Always test in a staging environment before deploying scheduled production jobs to avoid surprise off-hours runs.

Frequently Asked Questions

Related Terms

Want API access + no ads? Pro coming soon.