Is that possible to create recurring job after certain DateTime?

Hi, support

I’m using Hangfire version “1.6.8”. I want create recurring job with Cron.Daily after certain DateTime . Is that possible to create recurring job with delay time ?

Thanks

You could run a scheduled job to start after your certain date. It takes a timespan, so simply do the date math when starting the server and add the scheduled job. (use a custom id so you can also check if you’ve already scheduled it in case of server restart). Then, in this job, add your recurring job.

1 Like

Hi tracstarr,

Thank for your replay, I have already tried this method and it working good but is that possible without using Schedule job ?

Thanks

No, I don’t think so.

No. Either you have a recurring job (runs continuously with a fixed interval) or a scheduled job (runs at a certain time) - the job cannot be both.

If you don’t want to use a scheduled job, with is rather ingenious though, you can let the recurring job finish itself right away without executing any logic as long as the current DateTime is below the wanted DateTime.