I am trying to get Next Execution Date based on a Start Date and a Cron Expression using Quartz Cron Expression utility in Java. ( org.quartz.CronExpression
)
Following is my code to get next execution date
CronExpression exp = new CronExpression(cronExpression);
Date nextExecutionDate = exp.getNextValidTimeAfter(startDate);
Cron Expression is: 0 0 */1? * *
0 0 */1? * *
(every 1 hour)
Input Start Date is: 2020-06-15T16:41:00.00
Current Output of Next Execution Date is: 2020-06-15T17:00:00.000
However, I expect the output of Next Execution Date as 2020-06-15T17:41:00.000
Kindly share some pointers to achieve the expected output. Do I need to alter the Cron Expression or do I need to add some time offset from start date? Kindly suggest.
You should alter the cron expression like
0 41 */1 ? * *
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.