Base solution for your next web application
Open Closed

hangfire custom cron expression #6055


User avatar
0
otorento created

My scenario is like this. The user can choose an internal which is (Daily, Monthly, Yearly) and enter a number value. Also the user can choose a start date for the job.

Example 1: job start date is 15 DEC 2018, Interval each 3 months

The user expect that the job will be first run at 15 DEC 2018 then after 3 months the next execution will be occurred. which is here is 15 march 2019.

I tried to use Cron.MonthInterval(3) it is generate the expression like this "0 0 1 */3 *" but in this case the first run of the job from what i see in hangfire dashboard that the next execution will be at January 1, 2019 because Cron.MonthInterval will always generate expression at the first day of the month.

https://crontab.guru/#0_0_1_/3_

Looking for your help. Thank you


2 Answer(s)