Cron Expressions for a Function Timer Trigger

You can configure a cron expression in the following formats for a function timer trigger:

  • @every format

    The format is "@every N unit". N is a positive integer. unit can be ns, µs, ms, s, m, or h. An @every expression means to invoke a function every N time units, as shown in Table 1.

    Table 1 Example expressions

    Expression

    Meaning

    @every 30m

    Triggers a function every 30 minutes.

    @every 1.5h

    Triggers a function every 1.5 hours.

    @every 2h30m

    Triggers a function every 2.5 hours.

  • Standard format

    The format is "seconds minutes hours day-of-month month day-of-week". day-of-week is optional. The fields must be separated from each other using a space. Table 2 describes the fields in a standard cron expression.

    Table 2 Parameter description

    Parameter

    Description

    Value Range

    Special Characters Allowed

    Seconds

    Yes

    0-59

    , - * /

    Minutes

    Yes

    0-59

    , - * /

    Hours

    Yes

    0-23

    , - * /

    Day-of-month

    Yes

    1-31

    , - * ? /

    Month

    Yes

    1-12 or Jan-Dec. The value is case-insensitive, as shown in Table 3.

    , - * /

    Day-of-week

    No

    0-6 or Sun-Sat. The value is case-insensitive, as shown in Table 4. 0 means Sunday.

    , - * ? /

    Table 3 Value description of the month field

    Month

    Digit

    Abbreviation

    January

    1

    Jan

    February

    2

    Feb

    March

    3

    Mar

    April

    4

    Apr

    May

    5

    May

    June

    6

    Jun

    July

    7

    Jul

    August

    8

    Aug

    September

    9

    Sep

    October

    10

    Oct

    November

    11

    Nov

    December

    12

    Dec

    Table 4 Value description of the day-of-week field

    Day of Week

    Digit

    Abbreviation

    Monday

    1

    Mon

    Tuesday

    2

    Tue

    Wednesday

    3

    Wed

    Thursday

    4

    Thu

    Friday

    5

    Fri

    Saturday

    6

    Sat

    Sunday

    0

    Sun

    Table 5 describes the special characters that can be used in a cron expression.

    Table 5 Special character description

    Special Character

    Meaning

    Description

    *

    Used to specify all values within a field.

    * in the minutes field means every minute.

    ,

    Used to specify multiple values, which can be discontinuous.

    For example, "Jan,Apr,Jul,Oct" or "1,4,7,10" in the month field and "Sat,Sun" or "6,0" in the day-of-week field.

    -

    Used to specify a range.

    For example, "0-3" in the minutes field.

    ?

    Used to specify something in one of the two fields in which the character is allowed, but not the other.

    You can specify something only in the day-of-month or day-of-week field. For example, if you want your function to be executed on a particular day (such as the 10th) of the month, but do not care what day of the week that is, then put "10" in the day-of-month field and "?" in the day-of-week field.

    /

    Used to specify increments. The character before the slash indicates when to start, and the one after the slash represents the increment.

    For example, "1/3" in the minutes field means to trigger the function every 3 minutes starting from 00:01:00 of the hour.

    Table 6 describes several example cron expressions.

    Table 6 Example cron expressions

    Function Scheduling Example

    Cron Expression (UTC Time)

    12:00 every day

    0 0 4 * * *

    12:30 every day

    0 30 4 * * *

    26th, 29th, and 33rd minutes of each hour

    0 26,29,33 * * * *

    12:30 from Monday to Friday

    0 30 4 ? * MON-FRI

    Every 5 minutes during 12:00 and 14:00 from Monday to Friday

    0 0/5 4-6 ? * MON-FRI

    12:00 every day from January to April

    0 0 4 ? JAN,FEB,MAR,APR *