how to start a job any time in Quartz.net?

故事扮演 提交于 2020-01-11 10:28:12

问题


i need your help to learn Quartz.Net. But every sample is the same as each other. i want to startTime: 07.03.2012 13:28:10 but not working. Not return error code.how to start this time?

  DateTime startdate = DateTime.Parse("07.03.2012 10:28:10", culture, System.Globalization.DateTimeStyles.AssumeLocal);
       // DateTime startdate = Convert.ToDateTime("07.03.2012 09:46:10", culture);
        //DateTime zaman = new DateTime(2012, 3,6,17, 12, 11);

        DateTime parsedStartTime = DateTime.SpecifyKind(startdate, DateTimeKind.Utc);

        DateTime localStartTime = parsedStartTime.ToLocalTime();
        Trigger trigger = new SimpleTrigger("myFirstTrigger",
                                               null,
                                               parsedStartTime,
                                               null,
                                               5,
                                               TimeSpan.FromSeconds(10));

回答1:


Quartz.Net expects that you pass in dates and times in UTC. Try changing this line:

parsedStartTime 

to

parsedStartTime.ToUniversalTime())

or, make sure that parsedStartTime is in UTC before passing it in.



来源:https://stackoverflow.com/questions/9598601/how-to-start-a-job-any-time-in-quartz-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!