Learn

What Is a Cron Expression? Cron Syntax Explained

A cron expression is a string of five or six fields defining a recurring schedule: minute, hour, day of month, month, day of week, and optionally year. Used by Linux crontab, Kubernetes CronJobs, AWS EventBridge, and CI/CD pipelines.

Cron Fields

minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-7, 0 and 7 = Sunday). Special characters: * (any), , (list), - (range), / (step).

Common Examples

0 * * * * — every hour. 0 0 * * * — daily at midnight. */5 * * * * — every 5 minutes. 0 9 * * 1-5 — weekdays at 9 AM.

Cron vs Other Schedulers

Cron is simple and universal but lacks timezone awareness in basic implementations. Cloud schedulers (EventBridge, Cloud Scheduler) extend cron with timezone and one-off scheduling.

Frequently Asked Questions

Does cron use UTC or local time?

Traditional crontab uses the server's local timezone. Cloud schedulers often let you specify timezone explicitly. Always verify which timezone your scheduler uses.

What is the difference between 5 and 6 field cron?

Standard Unix cron has 5 fields. Some systems (AWS EventBridge, Quartz) add a seconds or year field as the 6th position.