Skip to content
cron.surf

Run a Quartz job every 20 minutes

The Quartz expression for “Every 20 minutes” is 0 */20 * * * ?. Below: config you can paste, the next run times, and what to watch out for. Quartz CronTrigger takes six or seven fields, seconds first, with Sunday as 1 and ? in one day field.

0 */20 * * * ?Open in tool

“Every 20 minutes”

CronTrigger

CronTrigger
Trigger trigger = TriggerBuilder.newTrigger()
    .withIdentity("every-20-minutes")
    .withSchedule(CronScheduleBuilder.cronSchedule("0 */20 * * * ?")
        .inTimeZone(TimeZone.getTimeZone("UTC")))
    .build();

Quartz gotchas

One day field must be ?Quartz does not support setting both day of month and day of week. Put ? in the one you do not use.
Sunday is 1Day of week runs 1-7 from SUN, so 2-6 is Monday to Friday. A crontab 1-5 means something else here.
MisfiresIf the scheduler is down at fire time, the misfire instruction decides what happens. The default fires once as soon as it can.
The year is optionalA seventh field limits the years. Leave it out to run every year.

FAQ

What is the Quartz cron expression for “Every 20 minutes”?

0 */20 * * * ?. It reads: Every 20 minutes

Which time zone does a Quartz schedule use?

In the JVM’s default time zone, unless you call inTimeZone() on the CronScheduleBuilder.

Is Quartz cron the same as Spring cron?

No. Both start with seconds, but Quartz counts Sunday as 1 and needs ? in one day field; Spring counts Sunday as 0 and has no year field.

What does L mean in Quartz?

In day of month, L is the last day of the month. In day of week, 6L is the last Friday, and L alone means Saturday.