Hello, I need to create a cron expression to run or process on the second business day after the 10th, 20th and last day of each month, I’m not sure how to do it.
That is not possible with a cron expression. Even with 3 separate schedules i don’t think choosing the 2nd workday after the 10th, 20th would work. Last day of the month would be easy enough though. This cron expression runs the last day of every month at noon:
0 0 12 L * ? *
Feel free to play around with this cron maker website which features an easy-to-use UI to create a cron expression: cronmaker.com
Did I do so 0 0 4 2W, 12W, 22W *? * but marks only the day closest to the week of day 2 and for other days not
I had a similar use case. My job had to run second business day after the end of a fiscal month, which never is on the same day as the end of the calendar month. Cron expression was not an option, but a custom non-working days calendar was the solution.
Go to Settings>Non-Working Days in your Orchestrator. You can either upload your own calendar, or mark the non-working days on the UI. Then just set up a trigger for the job, that runs everyday, and use the custom calendar for it. It will skip all the days that the calendar says are non-working, and only run on the free ones.
Will require some maintenance, but still a good solution.
Why the 2W? I thought it was just the 2nd workday after the 10th (e.g. that would be July 14th for this month, as July 10 is friday, then July 13th is first workday), and then the 2nd workday after the 20th (July 22nd this month).
Either way, that won’t work as you can’t specify 2nd workday after a specific date. I think @SSavickas had the best suggestion of manually creating a custom calendar and then updating it manually every year or couple of years. Since this only runs 3 times a month it would likely take less than an hour to set up that schedule manually for 1-5 years out. It’d certainly be faster than trying to do any alternatives
I created a personalized calendar, but only with the holidays.
Created a new custom calendar - it is going to be specific for this process and only this one will use it.
Mark ALL dates as holidays except that dates you want it to run. This means in July you would have 28 “holidays” and only the 3 days you want it to run are NOT marked as holidays.
Schedule your process to run daily and make sure you include the calendar you just created for the ‘Non-working days restrictions’ drop-down menu
I did so, thank you so much for your help!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.