Cron Expression: How to set alternate minute e.g every 5 minutes and stop at certain half an hour e.g. 16:30pm

Hi,Sorry I cant seem to locate this topic and decided to post it here. I would like to enquire the following. Maybe anybody could provide me an advice please.? Appreciate it. TQVM

How to set alternate minute e.g every 5 minutes and stop at certain half an hour e.g. 16:30pm in between 9.00am to 4.30pm Monday to Friday please?

Sean

Hello @LeeKK,

Cron Expressions cannot have range limits in Minutes, hence we cannot have 1 cron expression for your requirement. That said you can split it up into two schedules as follows:

  1. Schedule 1: Every 5 min 9am to 4pm : 0 5 9-16 ? * MON,TUE,WED,THU,FRI *
  2. Schedule 2: Every 5 min from 4 pm to 4:30 om: 0 5,10,15,20,25,30 16-17 ? * MON,TUE,WED,THU,FRI *

Hope this helps.
Kudos :slight_smile:

Regards,
Nithin

1 Like

As @Nithin_P mentioned, you would have to use two different cron expressions in order to facilitate the half hour; However, you can simplify the expression by dividing your minutes to create increments (i.e. */5)

Please have a read over Using Cron Expressions to see what is supported by the Quartz.Net framework used by UiPath.


This would produce

At 5 minutes past the hour, between 09:00 AM and 04:59 PM, only on Monday, Tuesday, Wednesday, Thursday, and Friday

What you would want is 0 */5 9-16 ? * MON-FRI *

Every 5 minutes, between 09:00 AM and 04:59 PM, Monday through Friday


The second expression would be

At 5, 10, 15, 20, 25, and 30 minutes past the hour, between 04:00 PM and 05:59 PM, only on Monday, Tuesday, Wednesday, Thursday, and Friday

Which could be simplified to 0 0-30/5 16-17 ? * MON-FRI * translating to

Every 5 minutes, minutes 0 through 30 past the hour, between 04:00 PM and 05:59 PM, Monday through Friday

2 Likes

Hi @codemonkee,

Thanks for noticing that. I got the split right, but I missed the */ part.

Thanks,
Nithin