CRON expressions are terrifyingly powerful – especially when you first start to pick them up. Once you’ve gotten the hang of them, you’re in a position to – unashamedly – weep when you realize that there are a couple of different flavours of CRON expressions that vary in subtle ways.
I spent a good couple of hours trying to track them down whilst adapting my CRON translator to understand Quartz CRON expressions as well as the more standard CRON expressions, and I found the following major differences which I figured I’d write down in case I needed them again someday.
The seconds field is a fairly obvious one – Quartz has it, CRON doesn’t. Easy enough.
Years field / command field
This one can differ – the standard implementations of CRON do not have a year field. In its place they do have a command field however, so there will be a value (or more) there.
Days of the Week
This one is a bit of a pain. Quartz uses values of 1-7 for SUN-SAT. Cron uses values of 0-6 for SUN-SAT, so you’ll need to offset when shifting from one to the other.