Description of quartz timed task time setting

These asterisks are represented in order from left to right: * * * * * * *     
                           Format: [seconds] [minutes] [hours] [days] [months] [weeks] [years]





Serial number description
  Is it required? Allowed values ​​Allowed wildcards

1 second is 0-59 , -*/
2 points are 0-59
   , - * /
3 hours is 0-23 , -*/
4th is 1-31, -*?/LW
May is 1-12 or JAN-DEC , -*/
6 weeks is 1-7 or SUN-SAT , -* ? / L #
7 years no empty or 1970-2099 , -*/


Wildcard description:
* means all values. For example: setting "*" on the field of minutes means it will be triggered every minute.
? means no value is specified. The use case is that you don't need to care about the value of the current setting of this field. For example: To trigger an operation on the 10th of each month, but don't care about the day of the week, so the field that needs the week position is set to "?" Specifically set to 0 0 0 10 * ?
- Indicates the interval. For example, setting "10-12" on the hour means that it will be triggered at 10, 11, and 12 o'clock.
, means specifying multiple values, for example, setting "MON,WED,FRI" on the week field means triggering on Monday, Wednesday and Friday
/ for incremental triggering. If "5/15" is set on the second, it starts from 5 seconds and triggers every 15 seconds (5, 20, 35, 50). Set '1/3' on the month field to start on the 1st of each month and trigger every three days.
L means the last. On the day field setting, it means the last day of the current month (according to the current month, if it is February, it will also depend on whether it is a leap year [leap]), and on the week field it means Saturday, which is equivalent to "7" or "SAT". If you add a number before "L", it means the last of the data. For example, setting the format "6L" on the week field means "the last Friday of this month"
W represents the closest working day (Monday to Friday) to the specified date. For example, if you set "15W" on the day field, it means that the trigger will be triggered on the working day closest to the 15th of each month. If the 15th happens to be Saturday, it will trigger on the nearest Friday (14th), if the 15th is a weekday, it will trigger on the nearest next Monday (16th). If the 15th happens to be on a working day (Monday to Weekly) 5), it will be triggered on that day. If the specified format is "1W", it means that it will be triggered on the nearest working day after the 1st of each month. If the 1st falls on a Saturday, it will trigger on the following Monday, the 3rd. (Note, only specific numbers can be set before "W", and interval "-" is not allowed).

hint
'L' and 'W' can be used in combination. If "LW" is set on the day field, it means that it is triggered on the last working day of the month (generally refers to the payment of wages)


# Serial number (indicates the day of the month), for example, setting "6#3" on the week field means the third Saturday of the month. Note that if "#5" is specified, there is no week in the fifth week. Six, the configuration will not be triggered (it's perfect for Mother's Day and Father's Day)

hint
The setting of the week field, if English letters are used, is case-insensitive. MON is the same as mon.



      
Common examples:


0 0 12 * * ? Triggered at 12:00 every day
0 15 10 ? * * Triggered at 10:15 every day
0 15 10 * * ? Triggered at 10:15 every day
0 15 10 * * ? * Triggered at 10:15 every day
0 15 10 * * ? 2005 Triggered at 10:15 every day in 2005
0 * 14 * * ? Triggers every minute from 2pm to 2:59pm every day
0 0/5 14 * * ? Every day from 2:00pm to 2:59pm (starts on the hour, triggers every 5 minutes)
0 0/5 14,18 * * ? Every day from 2pm to 2:59pm (starts on the hour, triggers every 5 minutes)
Every afternoon from 18:00 to 18:59 (starts on the hour, triggers every 5 minutes)

0 0-5 14 * * ? Trigger every minute from 2:00pm to 2:05pm every day
0 10,44 14 ? 3 WED March every Wednesday at 2:10 and 2:44 pm (special cases, in a time setting, executed twice or more)
0 59 2 ? * FRI triggers every Friday at 2:59 AM;
0 15 10 ? * MON-FRI fires at 10:15 am every day from Monday to Friday
0 15 10 15 * ? Triggered at 10:15 am on the 15th of every month
0 15 10 L * ? Triggered at 10:15 on the last day of every month
0 15 10 ? * 6L Triggered at 10:15 on Friday of the last week of each month
0 15 10 ? * 6L 2002-2005 Triggered at 10:15 on Friday of the last week of every month from 2002 to 2005
0 15 10 ? * 6#3 Triggered on Friday of the third week of each month
0 0 12 1/5 * ? Trigger every 5 days starting from the first noon of the month
0 11 11 11 11 ? Every year on November 11th at 11:11 trigger (Singles Day)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327026660&siteId=291194637
Recommended