Cron Expression Query

Hello guys ,

Can you help me in getting a cron expression for the below usecase.

The bot should run only on “weekdays , every 2 hrs from 8 am to 7 pm only” (NO saturday and sunday)

I have managed to get a cron expression for every 2 hrs on weekdays as below :

0 0 */2 ? * MON-FRI

(Hope the above one is right)

But not able to find how to set it up from 8 am to 7 pm only.

Can you please help me in this ?

Regards,
Gokul

0 0 8-19/2 ? * MON-FRI * Try this

1 Like
1 Like

Hai @gokul1904 , Try this- 0 0 8-19/2 ? * MON,TUE,WED,THU,FRI *

Hey @gokul1904

Another Cron Expression incase you still need it:
0 0 8,10,12,14,16,18 ? * MON,TUE,WED,THU,FRI *

Description:
At 08am, 10am, 12pm, 2pm, 4pm and 6pm, on every Monday, Tuesday, Wednesday, Thursday and Friday, every month

If you want to do a final run at 7pm (note the last two runs will only be 1 hour apart) then see the below expression:
0 0 8,10,12,14,16,18,19 ? * MON,TUE,WED,THU,FRI *

Description:
At 08am, 10am, 12pm, 2pm, 4pm, 6pm and 7pm, on every Monday, Tuesday, Wednesday, Thursday and Friday, every month

1 Like

Thanks alot Steven

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.