TimeTrigger for 5th Working Day of Month - Scheduled Web Job Azure

425 Views Asked by At

Im trying to write a TimerTrigger function that runs on the 5th working day of the month(the first day of month except sat/sun).If the first day is sat/sun,it should be run on Monday.So far i know how to run the job at 5th of every month, but how to exclude sat/sunday?

  public static void MyTimerFunction([TimerTrigger("0 0 0 5 * *")] TimerInfo myTimer, ILogger log)
        {

            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
        }
1

There are 1 best solutions below

0
Ecstasy On

Thank you user1672994. Posting your suggestion as an answer to help community members.

"Check with 0 0 0 * */1 Mon. The other thing what you do is to run this function Mon-Fri. don't execute the business logic if it's not 5th day or day after sat/sun."