Cron Expression For Specific Days Of Month AND Specific Days Of The Week

Trying to get a Cron expression working in Trigger but not able to get what I need.
Use Case; Run 6:30am every morning every day day of the month except the 1st day and only Mon-Friday.

My closest attempt is: 0 30 6 ? * 2-6 *

As soon as I try to change ? to 2-31 (So it runs only from the 2nd of each month to the 31st of each month) I get an error.

I understand you can’t specify specific days of the month and specific days of the week in the same expression.

But then how do I get what I need? Any help is appreciated.

Thanks team.

Hey @david.kameka

Welcome back to the forums :slight_smile:

You won’t be able to achieve this with a single cron expression (happy to be wrong).

You will need to combine the cron expression you have created in your post (0 30 6 ? * 2-6 *) with a non working days Calendar.

The calendar will need to be setup exclude the jobs running on the 1st of each month.

In summary, these two elements combined will make the job run at 6:30am Monday to Friday minus the 1st of each month because of the Non Working days calendar you have created.

Check out this post for how to do this:

Hopefully this helps you.

Reach out if you need a hand.


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