Quartz documentation gives an example for running a cron job on the last day of every month, like this:
0 15 10 L * ?
Fire at 10:15am on the last day of every month
However, I'd like to run a cron job on the 1st AND Last day of the month. I would expect the cron would look somthing like this:
0 15 10 1,L * ?
But this syntax is not valid by quartz.
I couldn't find any proper/similar example in their tutorial. Any suggestions?
So after some digging in quartz code I found this:
// throw an exception if L is used with other days of the month
if(exprOn == DAY_OF_MONTH && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(",")) {
throw new ParseException("Support for specifying 'L' and 'LW' with other days of the month is not implemented", -1);
}
org.quartz.CronExpression (quartz 2.2.2).
It seems 'L' is not supported for day-of-month with other days of the month. Too bad it's not anywhere in their documentation :(
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