Cron expression for every 30 seconds
Every 30 seconds
| Syntax | Expression |
|---|---|
| Unix crontab | Not supported: Unix crontab has minute resolution and cannot express second-level schedules. |
| Spring @Scheduled | */30 * * * * * |
| Quartz | */30 * * * * ? |
Open and edit in the explainer →
Next run times (UTC)
- Calculating…
Configuration examples
Spring
@Scheduled(cron = "*/30 * * * * *", zone = "UTC")
public void runJob() {
// ...
} Requires @EnableScheduling. Without zone, the server time zone is used.
Quartz
Trigger trigger = TriggerBuilder.newTrigger()
.withIdentity("myTrigger")
.withSchedule(CronScheduleBuilder.cronSchedule("*/30 * * * * ?")
.inTimeZone(TimeZone.getTimeZone("UTC")))
.build(); Quartz always needs "?" in either day-of-month or day-of-week.
More cron examples
Every minuteEvery 5 minutesEvery 10 minutesEvery 15 minutesEvery 30 minutesEvery hour (on the hour)Every 2 hoursEvery 6 hoursEvery day at midnightEvery day at 9 AMEvery day at 6 PMTwice a day (9:00 and 18:00)Weekdays at 9 AMEvery 10 minutes during business hoursWeekends at 10 AMEvery Monday at 9 AMEvery Sunday at midnightFirst day of every month15th of every monthLast day of every monthLast weekday of every monthSecond Monday of every monthLast Friday of every monthEvery quarter (Jan, Apr, Jul, Oct 1st)Every year on January 1stEvery 10 seconds