Hangfire CRON in UTC time
To execute a job in UTC
time zone, you can provide TimeZoneInfo
as TimeZoneInfo.Utc
while defining your jobs.
RecurringJob.AddOrUpdate(() => Console.Write("Easy!"), Cron.Daily, TimeZoneInfo.Utc);
To execute a job in local time zone you can use TimeZoneInfo.Local
.
To run in a specific timezone instead of UTC, look up the TimeZoneInfo
you want. The task will run at midnight.
var manager = new RecurringJobManager();
manager.AddOrUpdate("some-id", Job.FromExpression(() => Method()),
Cron.Daily(),
TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"));