As an example, you can use the following cron expression: "0 0 14 1 *?"
-> Fire on the 1st of every month at 14:00.
I used Quartz CronScheduleBuilder to create an exemption, but that doesn't matter.
My local time zone is UTC + 01: 00, and daylight saving time (this year) starts 03/31/2013 2:00, where the time is set to 3:00.
When I plan a new task using the proposed trigger, say, 02/20/2013, Quartz calculates the System.DateTimeOffset for "NextFireTimeUtc" correctly:
DateTime: 03/01/2013 13:00:00 (this is UTC, which is an hour behind the local time zone )
LocalDateTime: 03/01/2013 14:00:00
The task will start correctly within 14:00 hours, as indicated.
Now, if I plan a task for 03/20/2013, "NextFireTimeUtc" will result in:
DateTime: 04/01/2013 13:00:00 (this is UTC, which is now two hours behind the local time zone)
LocalDateTime: 04/01/2013 15: 00:00
Note that the resulting NextFireTimeUtc now falls into local daylight saving time. As a result, LocalDateTime has also been “adjusted” for an extra hour from UTC. This leads to the fact that the work is done at 15:00, and this is not what I want.
What I (obviously) expected was that "14" in the cron expression should always trigger at 14:00 even in the summer.
There should be an easy way to deal with this phenomenon, I probably just missed something conceptual. I'm confused.
EDIT:
, Quartz first NextFireTimeUtc current. , cron GetFireTimeAfter() , .
1: 28 14:00
GetFireTimeAfter now + 00 months: 28.03.2013 13:00:00 +00: 00 < -
GetFireTimeAfter now + 01 : 28.04.2013 12:00:00 +00: 00
GetFireTimeAfter now + 02 months: 28.05.2013 12:00:00 +00: 00
GetFireTimeAfter now + 03 : 28.06.2013 12:00:00 +00: 00
GetFireTimeAfter now + 04 : 28.07.2013 12:00:00 +00: 00
GetFireTimeAfter now + 05 months: 28.08.2013 12:00:00 +00: 00
GetFireTimeAfter now + 06 : 28.09.2013 12:00:00 +00: 00
GetFireTimeAfter now + 07 : 28.10.2013 13:00:00 +00: 00 < -
GetFireTimeAfter now + 08 : 28.11.2013 13:00:00 +00: 00
, " ". " " -1, +2.
1: 14:00
GetFireTimeAfter now + 00 months: 01.04.2013 13:00:00 +00: 00 < - ?
GetFireTimeAfter now + 01 : 01.05.2013 12:00:00 +00: 00
GetFireTimeAfter now + 02 months: 01.06.2013 12:00:00 +00: 00
GetFireTimeAfter now + 03 : 01.07.2013 12:00:00 +00: 00
GetFireTimeAfter now + 04 months: 01.08.2013 12:00:00 +00: 00
GetFireTimeAfter now + 05 : 01.09.2013 12:00:00 +00: 00
GetFireTimeAfter now + 06 : 01.10.2013 12:00:00 +00: 00
GetFireTimeAfter now + 07 : 01.11.2013 13:00:00 +00: 00 < -
GetFireTimeAfter now + 08 : 01.12.2013 13:00:00 +00: 00
, -1, 15:00.
, , , . ?