Another SO WTF



  • http://stackoverflow.com/q/11253499/239394

    In case of edit from the original:

    So, I have an application that displays log information to users across the entire country. For all users, EXCEPT those in Arizona, the times on the application are correct. For those lovely Arizonites, the time is always off by an hour (either ahead or behind, based on time of year).

    Here is my conversion code:

    [code language="C#"]
    internal static DateTime ConvertToEastern(DateTime from)
        {
            var dt = DateTime.Now;
            var d1 = TimeZone.CurrentTimeZone.GetDaylightChanges(dt.Year).Start;
            var d2 = TimeZone.CurrentTimeZone.GetDaylightChanges(dt.Year).End;
    
        if (dt.Ticks > d1.Ticks && dt.Ticks < d2.Ticks)
        {
            return TimeZoneInfo.ConvertTimeFromUtc(from, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
        }
        return TimeZoneInfo.ConvertTimeFromUtc(from, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")).AddHours(-1);
    }
    

    [/code]

    How can i make ^^ more robust for handling Arizona times. The method is called with a DateTime.UtcNow call.



  • Haha "This question has been removed by its author [due to utter embarassment]"



  •  Also, holy crap, SO's 404 image!  (explanation)

     



  • @emurphy said:

     Also, holy crap, SO's 404 image!  (explanation)
     

    ...it's things like these that make me realize how hopelessly stupid programmer I actually am... thank you, now my day is ruined TWICE.



  • @emurphy said:

     Also, holy crap, SO's 404 image!  (explanation)

     

    I want to see a polyglot that's both an Excel spreadsheet, and valid Z80 machine code (not assembler source, binary code).



  • @db2 said:

    I want to see a polyglot that's both an Excel spreadsheet, and valid Z80
    machine code (not assembler source, binary code).
    ... that's also a quine.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.