Partager via


Quiz of the Month: IsDaylightSavingTime() or not?

Question: Given your machine is in Pacific Time (PST) Time Zone, what is MainProgram.GetAnswer so that MainProgram.Test returns true?

class MainProgram

{

    static DateTime GetAnswer()

    {

          ????

    }

    static bool Test()

    {

        DateTime a = MainProgram.GetAnswer();

        String actual = String.Format("DateTime: {0}; IsDaylightSavingTime: {1}", a, a.IsDaylightSavingTime());

        String expected = "DateTime: 10/29/2006 1:30:00 AM; IsDaylightSavingTime: True";

        return (actual == expected);

    }

    static void Main(string[] args)

    {

    }

}

P.S. The answer will post in a week! I promised this time!

 

Note: Updated a clause here, that your machine needs to be in Pacific Time Zone