java timer

quartz timed task time setting description
These asterisks are represented in order from left to right: * * * * * * *       Format
                           : [seconds] [minutes] [hours] [days] [months] [weeks] [years

]
Required Allowed Values ​​Allowed Wildcards

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


Wildcard Explanation:
* means all Value. For example: set "*" on the field of minutes, it will trigger 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 * ?
- to indicate 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, if the format of "6L" is set on the week field, it means "the last Friday of the month"
W means the nearest working day (Monday to Friday) from the specified date. For example, if "15W" is set on the day field, it means 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).


TIP
'L' and 'W' can be used in combination. If "LW" is set on the day field, it means that it will be 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, set "6#" on the week field 3" means on the third Saturday of every month. Note that if "#5" is specified, and there is no Saturday in the fifth week, this configuration will not be triggered (it's perfect for Mother's Day and Father's Day)

Tips
The setting of the week field, if English letters are used, is case-insensitive. MON is the same as mon.
Common example:
0 0 12 * * ? Triggered at 12:00 every day
0 15 10 ? * * Triggered at 10:15 every day
0 15 10 * * ? Every day at 10:15 triggers
0 15 10 * * ? * Every day at 10:15 triggers
0 15 10 * * ? 2005 2005 every day at 10:15 triggers
0 * 14 * * ? Every day from 2:00 to 2:59 Minutes
0 0/5 14 * * ? Every day from 2:00 to 2:59 pm (starts on the hour, every 5 minutes)
0 0/5 14,18 * * ? Every day from 2:00 to 2:00 pm 59:00 (start on the hour, trigger every 5 minutes)
every afternoon from 18:00 to 18:59 (start on the hour, trigger every 5 minutes)
0 0-5 14 * * ? 2:00 to 2 pm every day Trigger
0 10 every minute at 05 ,

0 15 10 ? * MON-FRI Triggered at 10:15 am every day from Monday to Friday
0 15 10 15 * ? Triggered at 10:15 am on the 15th of each month
0 15 10 L * ? 10:00 on the last day of the month
0 15 10 ? * 6L 0 15 10 ? * 6L
0 15 10 ? * 6L 2002-2005 From 2002 to 2005,
0 15 is triggered at 10:15 on Friday of the last week of each month 10 ? * 6#3 Triggered on Friday of the third week of every month
0 0 12 1/5 * ? Triggered every 5 days from the first noon of every month
0 11 11 11 11 ? Every November 11th Triggered at 11:11 (Singles Day)  

Guess you like

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