Cron Expression: Every 30 minutes, Between 07:30-14:30 Daily

Hi all

Cron expression for every 30mins from 7.30am to 2.30pm everday

Hi @Arya_Squares,

0 0/30 7-14 ? * * *
The above one will give you from 7am - 2.30pm everyday in 30 minutes interval. After 2.30pm it won’t execute.

I do not think for 30 minutes interval you can create a cron for 7.30am-2.30pm.

Thank & Regards,
SD

Hi @Arya_Squares

Expression will start run at 7:00 - 14:30

0 0,30/0,30 7-14 ? * * *

image

You need to add implement the new condition → Process should not run at 7:00

New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second) > New DateTime(Now.Year, Now.Month, Now.Day, 07, 25, 0) And New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second) < New DateTime(Now.Year, Now.Month, Now.Day, 14, 40, 0)

image

Regards
Gokul

1 Like

whenever we cannot specify within a single cron we can split it to multiple crons as workaround

7:30
0 30 7 ? * * *

8 - 14 icl. 14:30
0 0,30 8-14 ? * * *

3 Likes

@ppr solution will be ideal without required code changes if that is any constraint.

For further idea, look through the Cron Tag and you’ll find many Topics with solutions that cover yours and similar scenarios.