Cron expression with start and end time
10,234
There is no other way to achieve it using single crone expression but to specify multiple crone expressions for specific startDate and endDate. There is a slight modification in second crone expression though (highlighted one)
0 15-59 10 * * * (Every minute between 10:15 AM and 10:59 AM)
0 * 11-16 * * * (Every minute, between 11:00 AM and 04:59 PM)
0 0-35 17 * * * (Every minute between 05:00 PM and 05:35 PM)
Author by
Sumit Paliwal
Updated on June 08, 2022Comments
-
Sumit Paliwal almost 2 years
I am trying to write an cron expression with a specific start time and end time everyday. i.e. every minute from 10:15 to 17:35 everyday
One possible solution for this is writing 3 different cron expressions like this:
0 15-59 10 * * * 0 * 11-17 * * * 0 0-35 17 * * *
Is there any possible way to write this in one single cron expression ?