Cron expression to schedule bot

Hi All,
Could you please help me with the cron expression … I need my bot to run on Monday after every 2nd Friday in every month.

Note : It’s not 3 rd Monday of the month, it may be 2 nd Monday as well if the month starts on tues r wed so on…

Hi @Bhanu123

Can you try with thsi Cron expression

0 0 0 ? * 2#2 * *

0 0 0 ? * MON#2 * *

Regards
Gokul

Hi @Bhanu123

Try this:
0 0 * * 1#2

You can use this website for cron expressions

Hello

Couple other methods/options:

  • Option 1: Create a trigger to run every monday and create a non-working day calendar (see below) and only allow the exact Monday you need each month.
  • Option 2: Create an excel file and insert a column with the Monday dates that you want the bot to run. Then run every Monday and compare this list against the current date.

Here is a the steps required to make a non-working days calendar:

Cheers

Steve

Hi,

you can use below Cron expression:

0 0 12 ? * MON#2

Hi @Bhanu123,

I’m very new to CRON but, can we say you want to schedule a process that occurs on the second Monday of the month and then repeats every Monday?

If yes, then you can use: 0 0 ? * MON#2/MON

Since Monday after 2nd Friday will be always 2nd Monday…let’s discuss in details if above shared expressions isn’t correct.

This will run on every 2nd Monday of the month right… what if month starts with Monday… then this logic fails right @neha.upase @Gokul001 @Aakash_Singh_Rawat @supriya117

Yeah but you said, want to schedule the process each Monday after 2nd Friday.
If month starts with Monday then it’s also not followed by 2nd Friday.

Hi

It is not possible to schedule a bot to run on Monday after every 2nd Friday in every month in UiPath Orchestrator using a single cron expression.
Unfortunately, UiPath Orchestrator’s standard cron expressions may not handle this specific scenario on its own.

You can schedule the bot daily but in your workflow have a IF condition to validate whether it’s Monday after second Friday of a month
If yes then execute that process if not don’t execute

Use this expression in your if condition

DateTime.Now.DayOfWeek = DayOfWeek.Monday AndAlso DateTime.Now > secondFriday.AddDays(3)

To get the second Friday variable value use this assign activity before to the if condition

Assign activity:
To: secondFriday
Value: Enumerable.Range(1, DateTime.DaysInMonth(CheckDate.Year, CheckDate.Month)) _
        .Select(Function(x) New DateTime(CheckDate.Year, CheckDate.Month, x)) _
        .Where(Function(x) x.DayOfWeek = DayOfWeek.Friday)(1)

I m suggesting this being a exceptional scenario

Hope this clarifies
Cheers @Bhanu123