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

2019-02-27 08:38发布

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条回答
唯我独甜
2楼-- · 2019-02-27 08:42

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.

查看更多
登录 后发表回答