I have to do the work every day at midnight Pacific Time. I am using MVC3 with the Quartz.NET library.
Here is my code:
public static void ConfigureQuartzJobs() { ISchedulerFactory schedFact = new StdSchedulerFactory(); IScheduler sched = schedFact.GetScheduler(); DateTime dateInDestinationTimeZone = System.TimeZoneInfo .ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, System.TimeZoneInfo.Utc.Id, "Pacific Standard Time").Date; IJobDetail job = JobBuilder.Create<TimeJob>() .WithIdentity("job1", "group1") .Build(); ITrigger trigger = TriggerBuilder.Create() .WithIdentity("trigger1", "group1") .StartAt(dateInDestinationTimeZone) .WithSimpleSchedule(x => x.WithIntervalInHours(24).RepeatForever()) .Build(); sched.ScheduleJob(job, trigger); sched.Start(); }
This code runs this work only once at midnight (Pacific time). I installed .WithSimpleSchedule(x => x.WithIntervalInHours(24).RepeatForever())
, but it does not work - the work does not repeat every day.
What can I do to make it work every day?
Any help is much appreciated!
source share