loki
loki

Reputation: 2966

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

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));

Upvotes: 2

Views: 1551

Answers (1)

jvilalta
jvilalta

Reputation: 6799

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.

Upvotes: 1

Related Questions