问题
I have some problems understanding the DateTimeOffset...
I am trying to create a simple-trigger for a Quartz-Job. There exists a triggerbuilder with which one can create such a trigger like this:
var triggerbuilder =
TriggerBuilder.Create()
.WithIdentity(triggerName, ConstantDefinitions.InternalDefinitions.AdhocJobGroup)
.StartAt(new DateTimeOffset(scheduledTime));
The scheduledTime is a DateTime. Let's say it is new DateTime(2014, 10, 15, 14, 0, 0);
I live in a city which lies in the Central European Time Zone (UTC+01:00).
When I print
var dto = new DateTimeOffset(new DateTime(2014, 10, 15, 14, 0, 0));
Console.WriteLine(dto);
I get the following result:
15.10.2014 14:00:00 +02:00
What does the +02:00 exactly mean? And why is it +2:00 and not +01:00? Does that mean, that my trigger will be started at 16:00 instead of 14:00?
Thanks in advance
回答1:
15.10.2014 14:00:00 +02:00
is a datetimeoffset (datetime + timezone) representing 2pm local time in a timezone of +2 UTC
this is equivalent to 15.10.2014 12:00:00
in UTC
With regard to why is it +02:00
rather than +01:00
, is daylight savings active?
Converting Between DateTime and DateTimeOffset
来源:https://stackoverflow.com/questions/26382559/working-with-datetimeoffset