I'm simply trying to determine if a given date falls within Daylight Saving Time. In 2017, Nov 5th at 2:00 AM should be the trigger.
- If my input is 11/5/17 00:00:00 the output is true for DST
- If my input is 11/5/17 01:00:00 the output is false for DST
I would have expected 1 AM to be true, and 2 AM to be false for DST
here is my code
var dateTime = new DateTime(2017,11,5,0,0,0);
var targetTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
if (targetTimeZone.IsDaylightSavingTime(dateTime)) {
Console.WriteLine("Daylight Saving Time");
}