none
Possible bug with Eastern Australian Daylight Savings and DateTime.IsDaylightSavings() RRS feed

  • Question

  • Hi All!

    After looking into an issue with a custoemr in Australia, i am wondering if i have stumbled across a bug in Windows/.Net or if i'm just missing something..

    Referencing the New South Wales website, their Daylight savings period for 2018/2019 ends on 7th April 2019 at 03:00. At this point, they stop Daylight Savings (AEDT - UCT+11) and the clocks go back 1 hour (AEST - UCT+1000).

    DateTime.IsDaylightSavings() method seems to return incorrectly based on date. It seems to say that the DST STARTS on 31st March 2019 whereas it started in October 2018 and should END on 7th April 2019.

    You can see this by running the following 2 commands:

    TimeZoneInfo.ConvertTimeFromUtc(new DateTime(2019,3,30,0,0,0, DateTimeKind.Utc), TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")).IsDaylightSavingTime();
    TimeZoneInfo.ConvertTimeFromUtc(new DateTime(2019,3,31,0,0,0, DateTimeKind.Utc), TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")).IsDaylightSavingTime();

    Please let me know if i am missing something or if this is a bug.

    Wednesday, March 20, 2019 3:11 PM

All replies

  • Your examples probably check the current timezone of your computer. (DateTime does not store the timezone).

    Check another method:

    var tz = TimeZoneInfo.FindSystemTimeZoneById( "AUS Eastern Standard Time" );
    
    bool b3 = tz.IsDaylightSavingTime( new DateTime( 2019, 3, 30, 0, 0, 0, DateTimeKind.Utc ) ); // true
    bool b4 = tz.IsDaylightSavingTime( new DateTime( 2019, 3, 31, 0, 0, 0, DateTimeKind.Utc ) ); // true
    bool b5 = tz.IsDaylightSavingTime( new DateTime( 2019, 4, 7, 1, 0, 0, DateTimeKind.Unspecified ) ); // true
    bool b6 = tz.IsDaylightSavingTime( new DateTime( 2019, 4, 7, 5, 0, 0, DateTimeKind.Unspecified ) ); // false
    bool b7 = tz.IsAmbiguousTime( new DateTime( 2019, 4, 7, 2, 30, 0, DateTimeKind.Unspecified ) ); // true





    Wednesday, March 20, 2019 7:38 PM
  • Hi

    Is your problem solved? If so, please post "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Jack

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 22, 2019 5:47 AM
    Moderator