suraj ippili
suraj ippili

Reputation: 3

Azure Function Cron Expression on 3rd weekday of the month

Is there any relevant CRON expression to trigger the azure function on the 3rd weekday of the month on specific months .I tried the cron expression "0 0 22 3W 2,5,8,11 ?"..The CRON expression indicates " At 22:00:00pm, on the nearest weekday to the 3rd of the month, in February, May, August and November" . It should be 3rd day of the respective months. If the 3rd day falls on a weekend(Saturday or Sunday) then the function on nearest weekday .But i am getting the below error When running it in Azure

"Microsoft.Azure.WebJobs.Host: Error indexing method 'RefundProcessForAppliedForTimerTriggerFunction'. Microsoft.Azure.WebJobs.Extensions: The schedule expression '0 0 22 3W 2,5,8,11 ?' was not recognized as a valid cron expression or timespan string."

Upvotes: 0

Views: 649

Answers (1)

Tspring
Tspring

Reputation: 141

Here is the main documentation to the cron expressions for timer triggers:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=in-process&pivots=programming-language-csharp#ncrontab-expressions

I believe you want something like this:
'0 0 22 * 2,5,8,11 3'

I read this as , 22 hour on the 2,5,8,11 month and 3rd day of the week.(day of the week going 0-6, believe 0 being sunday

If i'm misunderstanding and you just want the first weekday the 3rd day of the week of the month(just once a month on the third weekday)

Then you want this: I believe you want something like this:
'0 0 22 1-7 2,5,8,11 3'

Specific examples here:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=in-process&pivots=programming-language-csharp#ncrontab-examples

Upvotes: 1

Related Questions