Convert cron to Quartz / Spring
This page shows how to write a standard five-field Unix cron schedule as a Quartz / Spring schedule. Every example below is produced by the CronLabs engine. To convert an expression of your own, open the interactive converter.
Example conversions
Each row shows a common cron expression, what it does, and the equivalent Quartz / Spring schedule.
| Cron | Meaning | Quartz / Spring |
|---|---|---|
| 0 9 * * * | at 9:00 AM | 0 0 9 * * ? |
| */15 * * * * | every 15 minutes | 0 */15 * * * ? |
| 0 9 * * 1-5 | at 9:00 AM on weekdays | 0 0 9 ? * 2-6 |
| 0 0 * * 0 | Every Sunday at midnight | 0 0 0 ? * 1 |
| 0 0 1 * * | First day of every month at midnight | 0 0 0 1 * ? |
| 30 2 * * * | at minute 30 at 2:30 AM | 0 30 2 * * ? |
Ready-to-use Quartz / Spring configuration
The snippet below schedules a job for at 9:00 AM on weekdays (cron 0 9 * * 1-5). Replace the placeholder command and names with your own values.
Quartz / Spring · java
// Quartz CronTrigger
CronScheduleBuilder.cronSchedule("0 0 9 ? * 2-6");
// Spring @Scheduled (different day-of-week numbering)
@Scheduled(cron = "0 0 9 * * 1-5", zone = "UTC")Things to know about Quartz / Spring schedules
Quartz requires '?' in one day field; it was placed in day-of-week.
Quartz is 6-field with a leading seconds field (set to 0) and numbers days-of-week 1-7 (1=Sunday).
Spring's @Scheduled uses a different dialect. It numbers day-of-week 0-7 (0/7=Sunday) and allows '*' in both day fields. Use the Spring line below for Spring.
Quartz numbers days-of-week 1-7, where 1=Sunday. The day-of-week field was reindexed from the standard 0-6 numbering automatically.
Quartz requires '?' in one day field; it was placed in day-of-month.
Quartz can't match both day-of-month AND day-of-week. Converted to day-of-month only. Split into two schedules if you need both.
For the full syntax, see the official Quartz / Spring documentation.
Convert your own expression
Paste any cron expression into the validator to see its next run times, a calendar view, and the equivalent schedule for every supported platform.
Open the validator