Cron expression to schedule a job every two years

croncronexpressionquartz-scheduler

I'm building a Quartz cron expression to schedule a job to run on a specific day every two years from today. I've tested quite a few but I think one of the following should do the work:

53 18 23 12 ? 2013/2 => starting on year 2013 and on every two years later on
53 18 23 12 ? */2

But both of them fail the Quartz cron expression validation test. What could be the right cron expression?

Best Answer

Your Cron expression is incomplete. Quartz Cron expressions are made up of seven parts:

  1. Seconds
  2. Minutes
  3. Hours
  4. Day-of-Month
  5. Month
  6. Day-of-Week
  7. Year (optional)

So if you wanted to set up a schedule to run at 11:59pm on Dec 24th every two years starting in 2013, the expression would be:

0 59 23 24 12 ? 2013/2
Related Topic