Isuru Siriwardana
Isuru Siriwardana

Reputation: 545

CRON expression for 7am to 9pm in every two hours

I'm creating an azure function which should run on every two hours from 7am to 9pm everyday. I've tried build a CRON expression for this using a generator but it cannot meet both conditions (every two hours and from 7am-9pm). Can somebody please help me to build the expression.

Upvotes: 2

Views: 1388

Answers (2)

Robby Cornelissen
Robby Cornelissen

Reputation: 97322

You can just list the hours explicitly:

0 0 7,9,11,13,15,17,19,21 * * *

This should also work:

0 0 7-21/2 * * *

Upvotes: 2

Wah Yuen
Wah Yuen

Reputation: 1619

Perhaps this?

From 7am until 9pm (or 2100 hours) with a step value of 2 (ie. every 2 hours)

0 7-21/2 * * *

Upvotes: 3

Related Questions