Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

Help Center/ FunctionGraph/ User Guide/ Creating Triggers/ Cron Expressions for a Function Timer Trigger

Cron Expressions for a Function Timer Trigger

Updated on 2024-11-12 GMT+08:00
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

    Mandatory

    Value Range

    Special Characters Allowed

    CRON_TZ

    No. If this parameter is not set, the region's time zone is used by default.

    -

    -

    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 (Beijing Time)

    12:00 every day

    CRON_TZ=Asia/Shanghai 0 0 12 * * *

    12:30 every day

    CRON_TZ=Asia/Shanghai 0 30 12 * * *

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

    CRON_TZ=Asia/Shanghai 0 26,29,33 * * * *

    12:30 from Monday to Friday

    CRON_TZ=Asia/Shanghai 0 30 12 ? * MON-FRI

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

    CRON_TZ=Asia/Shanghai 0 0/5 12-14 ? * MON-FRI

    12:00 every day from January to April

    CRON_TZ=Asia/Shanghai 0 0 12 ? JAN,FEB,MAR,APR *

    NOTE:

    If no cron expression is set, the region's time zone is used by default. If your task will run in a specific time zone, use CRON_TZ to specify the time zone. For example, to trigger your function at 04:00 on the first day of each month (Beijing time), use CRON_TZ=Asia/Shanghai 0 0 4 1 * *. The time zone expression varies depending on the region.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback