Quartz Cron expression online generator, quartzcron
Cron Expressions -- Cron expression
In order
Seconds (0 ~ 59)
Minute (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, SUN, MON, TUE, WED, THU, FRI, SAT)
7. Year (1970-2099)
Each element can be a value (such as 6), a continuous interval (9-12), and an interval (8-18/4) (/indicates every 4 hours ), A list (1, 3, 5) with wildcards. Because the two elements "date in the month" and "date in the week" are mutually exclusive, one of them must be set ?.
0 0 10, 14, 16 **? Ten o'clock A.M., two o'clock P.M., every day
0 0/30 9-17 **? Every 30 minutes in 9 to 5 working hours
0 0 12? * WED indicates noon every Wednesday.
Some subexpressions can contain some scopes or lists.
Example: a subexpression (Day (week) can be "MON-FRI", "MON, WED, FRI", "MON-WED, SAT"
The "*" character represents all possible values.
Therefore, "*" indicates the meaning of each month in the subexpression (month), and "*" indicates each day of the week in the subexpression (Day (week ).
The "/" character is used to specify the increment of a value.
For example, in the subexpression (minute), "0/15" indicates that it starts from 0th minutes, every 15 minutes.
In the subexpression (minute), "3/20" indicates that the meaning starts from 3rd minutes and every 20 minutes (it is the same as "3, 23, 43 ").
"?" The character is only used in two subexpressions: Day (month) and day (week), indicating that no value is specified.
When one of the two subexpressions is specified, you need to set the value of another subexpression to "?" to avoid conflicts.
The "L" character is only used for two subexpressions: Day (month) and day (week). It is the abbreviation of the word "last ".
However, it has different meanings in two subexpressions.
In the subexpression of "month", "L" indicates the last day of a month.
In the expression "L" in the day (week), it indicates the last day of the week, that is, SAT.
If there is specific content before "L", it has other meanings.
For example, "6L" indicates the last 6th days of the month, and "FRIL" indicates the last Friday of the month.
Note: when using the "L" parameter, do not specify the list or range, because this will cause problems.
The Cron expression is used to configure the CronTrigger instance. A Cron expression is a string consisting of seven subexpressions. Each subexpression describes a separate schedule. These subexpressions are separated by spaces, respectively;
The implementation interface is as follows:
Demo: cron expression source code