CRON Expression to trigger Azure Function on the last day of each month

Viewed 630

Is there any CRON expression i can use to trigger an Azure Function on the last day of each month? It seems like such a typical scenario for a timer trigger, i'm suprised that i'm struggling to figure this out.

I'm currently using a workaround by triggering on dates 28-31 of each month and checking in code if it's the last day of the month, but that solution feels a bit hacky.

Even a definitive "Not possible" would be appreciated.

EDIT: Here is the code

using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using System;

namespace MyProsj.Functions.Triggers
{
    public static class LastOfEachMonth
    {
        [FunctionName("LastOfEachMonth")]
        public static void Run([TimerTrigger("0 0 20 28-31 * *")] TimerInfo myTimer, ILogger log)
        {
            if (DateTime.Now.AddDays(1).Day == 1)
            {
                //DO STUFF HERE
            }
        }
    }
}
1 Answers

Here is the Corn Expression for to run the trigger of the Azure Function on the last day of every Month. at 10:15 AM

15 10 * * 5L

enter image description here

For Further information check this Corn Expressions.

Related