I am using DateTime.ToLocalTime() to convert dates from UTC to local time. My time zone is GMT + 1 (Belgrade, Budapest, Lubnya ...), it is set correctly in the Windows (XP) settings.
Last weekend in our time zone, we switched to winter time in summer time, which means that we canceled the local time by one hour.
As I can see, the ToLocalTime method behaves strangely from now on. When I use it to convert dates that are after this winter time change, it works great, like this:
var utcDate2 = new DateTime(2011, 11, 2, 9, 0, 0,DateTimeKind.Utc);
utcDate1.ToLocalTime() Value: 2011.11.02. 10:00:00 2011.11.02. 10:00:00 it is correct
Burt, when I want to convert the date before this change (for example, date from daylight saving time), it returns an incorrect value like this:
var utcDate1 = new DateTime(2011, 10, 23, 9, 0, 0,DateTimeKind.Utc);
utcDate2.ToLocalTime() Value: 2011.10.23. 10:00:00 2011.10.23. 10:00:00 is incorrect. It should be 2011.10.23. 11:00:00
What should I do to get the correct values? How to use ToLocalTime, which also regulate winter / summer time?