Spring cron schedules
Spring’s @Scheduled(cron) takes six fields, seconds first, and needs every set day field to match. Pick a schedule for the exact expression, config you can paste and the next run times.
Schedules
- Every 5 minutes
0 */5 * * * * - Every hour
0 0 * * * * - Every minute
0 * * * * * - Every 10 minutes
0 */10 * * * * - Every 15 minutes
0 */15 * * * * - Every 30 minutes
0 */30 * * * * - Daily at midnight
0 0 0 * * * - Daily at 9 am
0 0 9 * * * - Weekdays at 9 am
0 0 9 * * 1-5 - Every Monday
0 0 0 * * 1 - First day of the month
0 0 0 1 * * - Every 6 hours
0 0 */6 * * * - Every Sunday at midnight
0 0 0 * * 0 - Every 2 hours
0 0 */2 * * * - Every 12 hours
0 0 */12 * * * - Daily at noon
0 0 12 * * * - Every Friday
0 0 0 * * 5 - Last day of the month
0 0 0 L * * - Every quarter
0 0 0 1 */3 * - Every 2 minutes
0 */2 * * * * - Every 3 hours
0 0 */3 * * * - Daily at 6 am
0 0 6 * * * - Daily at 6 pm
0 0 18 * * * - Twice a day
0 0 */12 * * * - Weekdays at 6 pm
0 0 18 * * 1-5 - Weekends at 10 am
0 0 10 * * 0,6 - 15th of the month
0 0 0 15 * * - First Monday of the month
0 0 9 * * MON#1 - Last Friday of the month
0 0 17 * * FRIL - Once a year
0 0 0 1 1 * - Every 30 seconds
*/30 * * * * * - Every 3 minutes
0 */3 * * * * - Every 20 minutes
0 */20 * * * * - Every 4 hours
0 0 */4 * * * - Every 8 hours
0 0 */8 * * * - Daily at 1 am
0 0 1 * * * - Daily at 2 am
0 0 2 * * * - Daily at 3 am
0 0 3 * * * - Daily at 8 am
0 0 8 * * * - Every weekday
0 0 0 * * 1-5 - Every weekend day
0 0 0 * * 0,6 - Every Tuesday
0 0 0 * * 2 - Every Wednesday
0 0 0 * * 3 - Every Thursday
0 0 0 * * 4 - Every Saturday
0 0 0 * * 6 - Every 6 months
0 0 0 1 */6 * - Every 10 seconds
*/10 * * * * * - Every 5 seconds
*/5 * * * * *
Spring gotchas
Seconds come firstSpring expressions have six fields: second, minute, hour, day of month, month, day of week. A five-field crontab line is rejected.
Both day fields must match0 0 9 1-7 * MON is the first Monday of the month. In crontab the same fields mean days 1-7 or any Monday.
Sunday is 0 or 7Unlike Quartz, where Sunday is 1. Names (MON-SUN) are safest when you move expressions between the two.
Scheduling must be switched onAdd @EnableScheduling to a configuration class or @Scheduled methods never run. By default all tasks share one thread.
Convert to and from Spring
Convert Spring cron to crontabConvert crontab cron to SpringConvert Spring cron to GitHub ActionsConvert GitHub Actions cron to SpringConvert Spring cron to KubernetesConvert Kubernetes cron to SpringConvert Spring cron to AWS EventBridgeConvert AWS EventBridge cron to SpringConvert Spring cron to QuartzConvert Quartz cron to Spring
FAQ
Which time zone does a Spring schedule use?
In the JVM’s default time zone. Set zone = "Europe/Berlin" (any IANA name) on @Scheduled to pin it.
Can Spring cron run every 30 seconds?
Yes. Spring has a seconds field: */30 * * * * *.
Does Spring support L and #?
Yes, since Spring 5.3: L, LW, L-n and nW in day of month, and dL or d#n in day of week.