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 ?
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With