All Products
Search
Document Center

Identity as a Service:Cron expression details

Last Updated:Nov 11, 2025

This document provides detailed information about the syntax rules and usage methods of Cron expressions in Alibaba Cloud IDaaS EIAM, helping you correctly configure scheduled task.

What is a Cron expression?

A Cron expression is a time expression used to configure scheduled tasks. It consists of a string of 6 or 7 fields separated by spaces, with each field representing a time unit.

Basic syntax

  1. Cron syntax format:

    Seconds Minutes Hours Day of month Month Day of week 【Year】

  2. Allowed values for each field

    Field position

    Time unit

    Value range

    Allowed special characters

    1

    Seconds

    0–59

    - * /

    2

    Minutes

    0–59

    - * /

    3

    Hours

    0–23

    - * /

    4

    Day of month

    1–31

    - * ? / L W C

    5

    Month

    1–12 or JAN–DEC

    JAN-DEC - * /

    6

    Day of week

    0–7 (both 0 and 7 represent Sunday) or SUN–SAT

    SUN-SAT - * ? / L C #

    7 (optional)

    Year

    Empty or 1970–2199 (optional field)

    , - * /

Special character descriptions

Character

Meaning

Description

*

Represents all values of a field.

If you set the Minutes field to an asterisk (*), the task is run every minute.

Represents all values of a field. You can use this character only in the Days or Weeks field because their values affect each other.

To trigger a schedule on the 20th day of each month, regardless of the day of the week, you can only use the following format: 13 13 15 20 * ?. Since the Days field has already specified the 20th, the last field (Weeks) can only use ?, not *. If the last field uses *, it means the task will be triggered regardless of the day of the week, which conflicts with the 20th day specified in the Days field, making the expression incorrect.

-

Represents a range of values.

If you set the Minutes field to 5-20, the task is run every minute from the 5th minute to the 20th minute of an hour.

/

Represents the start time and the interval, which are separated by this character. The task is run at the start time and then at the specified intervals.

If you set the Minutes field to 5/20, the task is run at the 5th, 25th, and 45th minutes of an hour.

,

Represents a list of different values.

If you set the Minutes field to 5,20, the task is run at the 5th and 20th minutes of an hour.

L

Represents the last day or week. You can use this character only in the Days or Weeks field.

If you set the Weeks field to 5L, the task is run on the last Thursday of a month.

W

Represents the business days from Monday to Friday. You can use this character only in the Days field. The task is run on the business day nearest to the specified date.

If you set the Days field to 5W and the 5th day of a month is Saturday, the task is run on the 4th day of the month (Friday), the nearest business day. If the 5th day of a month is Sunday, the task is run on the 6th day of the month (Monday). If the 5th day of a month is a business day, the task is run on that day. The nearest business day is limited to the current month.

LW

Represents the last business day of a month, which is the last Friday.

#

Represents the nth occurrence of a day of the week in a month. You can use this character only in the Weeks field.

If you set the Weeks field to 4#2, the task runs on the second Wednesday of a month, where 4 indicates Wednesday and 2 indicates the second occurrence.

Common examples

Warning

The Cron expressions in IDaaS identity provider require intervals of at least 1 hour. We recommend that you control the intervals appropriately to ensure that the data synchronization frequency meets your expectations.

Example

Description

0 0 */2 * * ?

Run every 2 hours

0 0 2 1 * ?

Run at 2 AM on the 1st day of each month

0 15 10 ? * MON-FRI

Run at 10:15 AM from Monday to Friday

0 0 23 * * ?

Run at 11 PM every day

0 0 1 * * ?

Run at 1 AM every day

0 0 1 1 * ?

Run at 1 AM on the 1st day of each month

0 0 23 L * ?

Run at 11 PM on the last day of each month

0 0 1 ? * L

Run at 1 AM every Sunday

0 0 0,13,18,21 * * ?

Run at 12 AM, 1 PM, 6 PM, and 9 PM every day

0 0 10,14,16 * * ?

Run at 10 AM, 2 PM, and 4 PM every day

0 0 12 ? * WED

Run at 12 PM every Wednesday

0 0 12 * * ?

Run at 12 PM every day

0 15 10 ? * *

Run at 10:15 AM every day

0 15 10 * * ?

Run at 10:15 AM every day

0 15 10 * * ? *

Run at 10:15 AM every day

0 15 10 * * ? 2025

Run at 10:15 AM every day in 2025

0 15 10 15 * ?

Run at 10:15 AM on the 15th day of each month

0 15 10 L * ?

Run at 10:15 AM on the last day of each month

0 15 10 ? * 6L

Run at 10:15 AM on the last Friday of each month

0 15 10 ? * 6L 2025-2026

Run at 10:15 AM on the last Friday of each month from 2025 to 2026

0 15 10 ? * 6#3

Run at 10:15 AM on the third Friday of each month

Note

The time parameters in this example (including the year) can be adjusted flexibly according to your actual needs.