Generate Quartz Cron Expression Every 2nd monday/friday

拥有回忆 提交于 2019-12-08 04:32:49

问题


How can i generate cron expression for every month 2nd/4th of monday/friday in quartz.Please help me


回答1:


You will need to create two triggers for the job.

The first trigger for the 2nd Monday:

0 0 12 ? 1/1 MON#2 *

And the second trigger for the 4th Friday:

0 0 12 ? 1/1 FRI#4 *



回答2:


According to the docs, you can specify (e.g.) the 2nd Monday of the month by putting MON#2 or 1#2 in the day-of-week field.

The '#' character is allowed for the day-of-week field. This character is used to specify "the nth" XXX day of the month.

But composing these like MON#2,FRI#4 in a single cron expression is specifically prohibited, so you need multiple CronTriggers.



来源:https://stackoverflow.com/questions/16935701/generate-quartz-cron-expression-every-2nd-monday-friday

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