DateTime inconsistency around DST fall back hour (1-2 AM) - by MTREDER

Status : 


Sign in
to vote
ID 778844 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 2/8/2013 10:10:05 AM
Access Restriction Public


In order to handle historic DST rules one would need to use TimeZoneInfo.ConvertTime* methods.  If one tries to use the ConvertTimeFromUtc for a UTC instant that occurs during the DST 1-2 am hour, this does not work correctly.  When investigating the result of the ConvertTimeFromUtc call you'll notice that the IsDaylightSavingTime method does not return the correct result (it returns false when it should be true).  However, if you look at the difference in Ticks it shows the correct offset.  Also, if you investigate the UTC DateTime with the appropriate TimeZoneInfo using IsDaylightSavingTime, it returns the correct result.  What is even more confusing is that if you were to use the ToLocalTime method on DateTime, it will return correctly.  However, this is not an option due to this function not working properly for historic DateTime instances and the possible need to convert to time zones other than the local time zone of the machine.

The end result is that you can't convert from Utc to a different time zone, back to Utc for this one hour of the year.

I don't see anywhere in the documentation that calls this out or gives a valid reason for the discrepancy.
Sign in to post a comment.
Posted by MTREDER on 3/4/2013 at 6:22 AM
Is there an estimate as to when this will be fixed?
Posted by MTREDER on 3/4/2013 at 6:20 AM
The problem is not converting from local to UTC as the APIs don't allow you to create a local instant in the DST 1am hour of the fall-back day.
Posted by Microsoft on 3/1/2013 at 2:13 PM

one small note I forgot to mention, if your local timezone is Central and the date you are converting from Central timezone to UTC is marked as DateTimeKind.Local this will make this problem disappear
Posted by Microsoft on 3/1/2013 at 1:41 PM

Thank you for reporting this issue. This is a valid bug and we’ll look at it during the future releases.
Posted by Helen [MSFT] on 2/10/2013 at 6:11 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Macy [MSFT] on 2/8/2013 at 10:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(