The scheduled task trigger rules support the input of Crontab expressions.
Time conversion rule: Local time - time zone offset = UTC
Taking Beijing time to UTC time as an example:
Beijing is in the East Eight Time Zone, with a time difference of 8 hours between Beijing time and UTC. The time conversion rule is:
Beijing Time - 8 = UTC
Example 1: Beijing time 9:42 converts to UTC time: 42 09 - 00 08 = 42 01, which means the UTC time is 1:42 AM.
Example 2: Beijing time 4:32 AM converts to UTC time: 32 04 - 00 08 = -68 03. If the result is negative, it indicates the previous day, requiring another conversion: -68 03 + 00 24 = 32 20, which means the UTC time is 8:32 PM of the previous day.
Basic format and value range of Crontab: minute hour day month weekday
, with the corresponding value ranges as shown in the table below:
Minute | Hour | Day | Month | Weekday |
---|---|---|---|---|
[0-59] | [0-23] | [1-31] | [1-12] or [JAN-DEC] | [0-6] or [SUN-SAT] |
The special characters allowed in the minute hour day month weekday
fields include:
,
: Value list separator, used to specify multiple values. For example: 1,2,5,7,8,9
.-
: User-defined value range. For example: 2-4
, which represents 2, 3, 4.*
: Represents the entire time period. For example, when used for minutes, it means every minute./
: Used to specify the increment of values. For example: n/m
indicates starting from n, increasing by m each time.Common Examples:
Input 30 18 25 12 *
indicates a task triggers at 18:30:00 on December 25th
.
Input 30 18 25 * 6
indicates a task triggers at 18:30:00 every Saturday
.
Input 30 18 * * 6
indicates a task triggers at 18:30:00 on Saturdays
.
Input * 18 * * *
indicates a task triggers every minute starting from 18:00:00
(including 18:00:00
).
Input 0 18 1,10,22 * *
indicates a task triggers at 18:00:00 on the 1st, 10th, and 22nd of every month
.
Input 0,30 18-23 * * *
indicates a task triggers at 00 minutes and 30 minutes of each hour between 18:00 and 23:00 daily
.
Input * */1 * * *
indicates a task triggers every minute.
Input * 2-7/1 * * *
indicates a task triggers every minute between 2 AM and 7 AM daily.
Input 0 11 4 * mon-wed
indicates a task triggers at 11:00 AM on the 4th of every month and on every Monday to Wednesday
.