java quartz CronScheduleBuilder

CronScheduleBuilder.cronSchedule("0 0 12 ? * WED");

Cron表达式总共有7个位置分别是
Seconds
Minutes
Hours
Day-of-Month
Month
Day-of-Week
Year (optional field)

表达 seconds minutes hours dayofmonth month dayofweek year
每周三12点执行 0 0 12 ? * WED

1.每个位置可以是范围,可以是列表,也可以是混搭
“MON-FRI”, “MON,WED,FRI”, or “MON-WED,SAT”.

2.*表示所有可能的月份

3.数字指代时间
0 to 59 for seconds and minutes
0 to 23 for hours
Day-of-Month can be any value 1-31
Months can be specified as values between 0 and 11, or by using the strings JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV and DEC.
Days-of-Week can be specified as values between 1 and 7 (1 = Sunday) or by using the strings SUN, MON, TUE, WED, THU, FRI and SAT.

4./
‘0/15’ means ‘every 15th minute of the hour, starting at minute zero’
‘3/20’ ‘every 20th minute of the hour, starting at minute three’ 等价于 ‘3,23,43’

5.在weekday和monthday中二选一,?表示不选的一方

6.L代表last

在monthday中
L 表示月中最后一天
L-3 表示月中倒数第三天

在weekday中
L 表示星期中最后一天
L-3 表示星期中倒数第三天
6L 表示每个月最后一个周五

7#
“6#3"或"FRI#3” 表示每月第三个周五

参考:
http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/tutorials/tutorial-lesson-06.html
http://www.quartz-scheduler.org/api/2.3.0/org/quartz/CronScheduleBuilder.html

猜你喜欢

转载自blog.csdn.net/claroja/article/details/114005507