问题
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?
回答1:
Your Cron expression is incomplete. Quartz Cron expressions are made up of seven parts:
- Seconds
- Minutes
- Hours
- Day-of-Month
- Month
- Day-of-Week
- 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
来源:https://stackoverflow.com/questions/20745514/cron-expression-to-schedule-a-job-every-two-years