开发者

Quartz.net: FireAtTime doesn't seem to work as expected

I am trying to implement Quartz.net in one of my projects.

I am using NthIncludedDayTrigger cause I want my trigger to fire every 5 months at a certain time. Here is the code:

NthIncludedDayTrigger trigger = new NthIncludedDayTrigger(triggerName, groupName);
trigger.Description = "My trigger";
trigger.StartTimeUtc = startDate;
trigger.EndTimeUtc = endD开发者_StackOverflow中文版ate;
trigger.IntervalType = NthIncludedDayTrigger.IntervalTypeMonthly;
trigger.N = 5;
trigger.FireAtTime = "09:00";

DateTime? Check = DateTime.Now;
DateTime? When = trigger.GetFireTimeAfter(Check.Value);

As you can see I want my trigger to run at 9AM (my timezone is GMT => Greenwich). When I check (GetFireTimeAfter) the next fire time I can see it is at 8AM. I've checked the timezone trigger.TimeZone and it is absolutely fine. Is anyone here who can try to help? Thanks.


Just to be sure, you should use DateTime.UtcNow instead of DateTime.Now to get a DateTime that has its Kind set to UTC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜