Cron Jobs: The Complete Developer Reference
Cron Syntax Explained: All 5 Fields
The standard cron format has exactly 5 space-separated fields:
[minute] [hour] [day-of-month] [month] [day-of-week]
Field ranges:
- Minute: 0–59
- Hour: 0–23 (24-hour clock)
- Day of month: 1–31
- Month: 1–12 (or JAN–DEC)
- Day of week: 0–7 (0 and 7 both = Sunday, or SUN–SAT)
Special characters:
- * — every value
- */n — every n-th value (e.g., */5 for every 5 minutes)
- a-b — range (e.g., 1-5 for Mon–Fri)
- a,b,c — list (e.g., 1,15 for the 1st and 15th)
- L — last (e.g., L in day-of-month = last day of month, not all systems support this)
20 Essential Cron Patterns Every Developer Should Know
Here are the most commonly used cron patterns:
* * * * *— Every minute*/5 * * * *— Every 5 minutes0 * * * *— Every hour (on the hour)0 0 * * *— Every day at midnight0 9 * * *— Every day at 9:00 AM0 9 * * 1— Every Monday at 9:00 AM0 9-17 * * 1-5— Every hour from 9 AM to 5 PM, Mon–Fri0 0 1 * *— First day of every month at midnight0 0 L * *— Last day of every month (Linux cron)0 0 * * 0— Every Sunday at midnight30 23 * * *— Every day at 11:30 PM0 */6 * * *— Every 6 hours0 0 1 1 *— January 1st at midnight (New Year's reset)*/15 9-17 * * 1-5— Every 15 min during business hours0 2 * * *— Every night at 2:00 AM (common for backups)
Cron Across Different Platforms: Key Differences
Cron syntax varies between platforms — watch for these differences:
Linux/Unix crontab: Standard 5-field format. Supports @reboot, @daily, @hourly shortcuts.
AWS EventBridge / CloudWatch: Uses 6-field format with year: cron(0 9 ? * MON-FRI *). Also uses ? for 'no specific value' in day fields.
Spring Framework (@Scheduled): 6-field with seconds first: 0 0 9 * * MON-FRI.
GitHub Actions: Uses standard 5-field cron syntax in schedule: triggers. Runs in UTC.
Kubernetes CronJobs: Standard 5-field. Timezone support was added in Kubernetes 1.27 with timeZone field.
Always test cron expressions in a staging environment. An off-by-one in the hour field can cause jobs to run at 3 AM instead of 9 AM.