I'm trying to understand why my date is wrong:
DateTime databaseUtcTime = new DateTime(2016, 8, 15, 10, 20, 0, DateTimeKind.Utc);
var timeZone = TimeZoneInfo.FindSystemTimeZoneById("Central Europe Standard Time");
var testDateTime = TimeZoneInfo.ConvertTimeFromUtc(databaseUtcTime, timeZone);
testDateTime
outputs 15/08/2016 12:20:00 rather than 15/08/2016 11:20:00
why is this? Shouldn't it be 1 hour forward from UTC, not 2 ?
EDIT----
Thanks Jon Skeet,
If this helps anyone, i resorted to using:
if(testDateTime.IsDaylightSavingTime())
{
testDateTime = testDateTime.AddHours(-1);
}
Albeit you not knowing the context, this could be helpful to know how to get rid of daylight saving time when running certain explicit testing on time.