Custom Cron Expression to schedule for first monday

Hi guys,

We’re planning to schedule an automation to run every first Monday of every month at 6pm, we need a cron expression for it. anybody aware about how to create these kind of expressions or done something similar?

thanks

Hi @shivamkaushik319,

UiPath uses the Quartz library to generate custom cron expressions (.Net port). So an online generator like this one is good tool to know about: Free Online Cron Expression Generator and Describer - FreeFormatter.com

UiPath documentation is not that extensive yet: Using Cron Expressions (uipath.com)

We’re planning to schedule an automation to run every first Monday of every month at 6pm

Solution:

  • 0 0 18 ? * 2#1 *

0 seconds, 0 minutes, 18 hours, no value on the day, 1st of Monday any month, any year

This is how it would look in Orchestrator.

You should also beaware of some limitations to this implementation in Quartz when it comes to filtering on day of month (number) and day of week. You can read about it here: Schedule the bot on every 28th of the month - Manage / Orchestrator - UiPath Community Forum
In your case, this limitation does not apply, but still good to know about.

Hope this helps!

2 Likes

Thanks a lot Jeevith.

Hi jeevith,

the expression you shared - 0 0 18 ? * 2#1 *

When i input this in orchestrator , it shows every first Tuesday of the month instead of first Monday and FreeFormatter.com is also generating the same expression for First Monday.

What could be the issue here?

Hi @shivamkaushik319,

That is because the region of your orchestrator may have 1st day in the week as Monday and second as Tuesday. i.e., week starts on a Monday and not Sunday so you can therefore try 0 0 18 ? * 1#1

I am not a 100% sure, but cron expressions in UiPath depend on the region as well I think. For my region 0 0 18 ? * 2#1 returns every Monday

But it might also be due to the configs used in the orchestrator and nothing to do with Timezones.

Hi @jeevith

Yes, Week was starting with Monday that is why it was coming up.
I checked and this works - 0 0 18 ? * 1#1

but I used - 0 0 18 ? 1/1 MON#1 *

This will work even if config changes for the orchestrator.

1 Like

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