Cron expression to schedule a job every two years

喜夏-厌秋 提交于 2019-12-22 00:15:31

问题


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:

  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


来源:https://stackoverflow.com/questions/20745514/cron-expression-to-schedule-a-job-every-two-years

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!