guys,
I have monthly jobs scheduled(using Quartz) by users. Users provide starting date f or first job to run, it could be any day of month 1-31
My question is how to schedule this using cron trigger, having in mind that not all month have 31,30,29th days. In such case job should run closest previous day of the month. So, lets say April has only 30 days, so job has to run on 30th of April.Can it be done using single cron trigger? Or should it be combination of triggers? I tried to play with CronExpression to see how it handles such cases:
CronExpression ce = new CronExpression("0 0 0 30 JAN-DEC ? *");
Date nextValidTime = ce.getNextValidTimeAfter(//**27th of February**//);
I've got nextValidTime equal to 30th of March, so cron just "skipped" February. Any help would be highly appreciated. Thanks in advance.