Quartz cron expressions

A cron expression has at least 6 (and possibly 7) time elements separated by spaces.

in order of

Seconds (0~59)

minutes (0~59)

hour (0~23)

Day (month) (0~31, but you need to consider the number of days in your month)

Month (0~11)

Day (week) (1~7 1=SUN or SUN, MON, TUE, WED, THU, FRI, SAT)

7. Year (1970-2099)

where each element can be a value (such as 6), a continuous interval (9-12), an interval (8-18/4) (/ means every 4 hours), a List(1,3,5), wildcard. Since the two elements "day of the month" and "day of the week" are mutually exclusive, it is necessary to set one of them?.

0 0 10,14,16 * * ? Daily 10am, 2pm, 4pm
0 0/30 9-17 * * ? Every half hour during 9 to 5 business hours
0 0 12 ? *WED means each Wednesday at 12:00 PM 
"0 0 12 * * ?" Every day at 12:00 PM 
"0 15 10 ? * *" Every day at 10:15 AM 
"0 15 10 * * ?" Every day at 10:15 AM 
"0 15 10 * * ? *" fires 
"0 15 10 * * ? 2005" every day at 10:15 am "0 * 14 * * ?" fires 
"0 * 14 * * ?" every day from 2 pm to 2:59 pm every day in 2005 Minute trigger  "0 0/5 14 * * ?" triggers "0 0/5 14,18 * * ?"
every 5 minutes between 2pm and 2:55pm every  day between 2pm and 2:55pm
and triggers "0 0-5 14 * * ?" every 5 minutes between 6pm and 6:55  pm and triggers "0 10,44 14 ? 3 WED"
every 1 minute between 2pm and 2:05pm every day 
Trigger "0 15 10 ? *MON-FRI" every March at 2:10 pm and 2:44 pm on Wednesday every year  Trigger "0 15 10 15 * ?" every 15th of the month
at 10:15 am Monday-Friday 
15 trigger 
"0 15 10 L * ?" Triggered at 10:15 am on the last day of the month
"0 15 10 ? * 6L" Triggered at 10:15 am on the last Friday of the month 
"0 15 10 ? * 6L 2002-2005" Triggered on the last Friday of every month from 2002 to 2005 at 10:15 am 
"0 15 10 ? * 6#3" Triggered on the third Friday of every month at 10:15 am 

Some subexpressions can contain ranges or lists

For example: subexpression ( day (week) ) can be "MON-FRI", "MON, WED, FRI", "MON-WED,SAT"

The "*" character represents all possible values

Therefore, "*" in the subexpression ( month ) represents the meaning of each month, and "*" in the subexpression ( day (week) ) represents each day of the week

 

The "/" character is used to specify the increment of the value

For example: "0/15" in the subexpression (minutes) means starting from the 0th minute, every 15 minutes

         "3/20" in the subexpression (minutes) means starting from the 3rd minute, every 20 minutes (it has the same meaning as "3, 23, 43")


The "?" character is only used for day (month) and day (week) subexpressions, indicating that no value is specified

When one of the two subexpressions is assigned a value, in order to avoid conflicts, the value of the other subexpression needs to be set to "?"

 

The "L" character is only used in day (month) and day (week) subexpressions, it is an abbreviation for the word "last"

But its meaning is different in the two subexpressions.

In the day (month) subexpression, "L" represents the last day of the month

In the day (week) self-expression, "L" represents the last day of the week, which is SAT

If there is specific content before the "L", it has other meanings

For example: "6L" means the 6th last day of the month, "FRIL" means the last Friday of the month

Note: When using the "L" parameter, do not specify a list or range as this can cause problems

 

 

Field Allowed Values ​​Allowed Special Characters
  0-59   , - * /
  0-59   , - * /
小时   0-23   , - * /
日期   1-31   , - * ? / L W C
月份   1-12 或者 JAN-DEC   , - * /
星期   1-7 或者 SUN-SAT   , - * ? / L C #
年(可选)   留空, 1970-2099   , - * /

 

http://biaoming.iteye.com/blog/39532

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326499728&siteId=291194637