Created
April 14, 2015 23:52
-
-
Save jkodroff/9d49e590b20fe1bb06b2 to your computer and use it in GitHub Desktop.
Working cron expression in Hangfire
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scheduledTime = DateTime.Today.AddHours(19).AddMinutes(-1).ToUniversalTime(); | |
new RecurringJobManager() | |
.AddOrUpdate( | |
"upcoming-jobs-email", | |
Job.FromExpression(() => ObjectFactory.GetInstance<BackgroundJobs.UpcomingJobsEmails>().Run()), | |
// M-F, 6:59 PM, but in UTC (as Hangfire can only process UTC) and a minute early so it's on the same day | |
"{0} {1} * * 1-5" | |
.ToFormat(scheduledTime.Minute, scheduledTime.Hour) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment