Cron Exp

I want to trigger a bot From Monday to Friday at 9.00AM
0 9 * * 1-5
Is this Expression right or not?
Error Invalid cron expression syntax (#1600)

Hi @AbarnaKalaiselvam

0 0 9 ? * MON-FRI

  • The first “0” represents the seconds (set to 0).
  • The second “0” represents the minutes (set to 0).
  • The “9” represents the hour (set to 9).
  • The “?” means the cron expression doesn’t specify the day of the month.
  • The “*” means the cron expression doesn’t specify a particular month.
  • The “MON-FRI” represents Monday to Friday.

or
0 0 9 * * 1-5
Hope it helps!!

@AbarnaKalaiselvam

The expression you provided is almost correct, but it is missing the minutes field. In a cron expression, there are five fields representing the minute, hour, day of the month, month, and day of the week.

To trigger a bot from Monday to Friday at 9:00 AM, the correct cron expression would be:

0 9 * * 1-5

1-5 : This field represents the day of the week, and it’s set to “1-5,” which means the bot will trigger from Monday to Friday (1=Monday, 2=Tuesday, and so on).


worked and checked with:

1 Like

Hi @AbarnaKalaiselvam

0 9 * * 1-5

Let’s break down the cron expression:

  • 0: Represents the minute field. It indicates the 0th minute of the hour, i.e., when the hour starts (9:00 AM).
  • 9: Represents the hour field. It indicates 9, the hour at which you want to trigger the bot.
  • *: Represents any value. It’s used in the day of the month and month fields to match any day of the month and any month.
  • *: Represents any value. It’s used in the month field to match any month.
  • 1-5: Represents the day of the week field. It indicates Monday to Friday, where 1 represents Monday and 5 represents Friday. The hyphen “-” is used to specify a range.

So, the cron expression 0 9 * * 1-5 translates to “At 9:00 AM, every day from Monday to Friday.”

Regards

@AbarnaKalaiselvam

If you find the solution please mark as solution to close the loop

Happy Automation!!

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