locked
ToUniversalTime strange behavior RRS feed

  • Question

  • Hi. ToUniversalTime() returns incorrect DateTime for (2013, 3, 17, 1, 0, 0).

    see my code:


     //d1 is less than d2 how ever after converting to utc
                //resault is strange and d1Utc is greater than d2Utc
                DateTime d1 = new DateTime(2013, 3, 17, 0, 45, 0);
                DateTime d2 = new DateTime(2013, 3, 17, 1, 0, 0);
                
                var d1Utc = d1.ToUniversalTime();
                var d2Utc = d2.ToUniversalTime();
    
                Console.WriteLine(d1Utc.ToString());  //3/16/2013 9:15:00 PM
                Console.WriteLine(d2Utc.ToString());  //3/16/2013 8:30:00 PM

    Tanks in advance

    Tuesday, March 6, 2012 7:15 PM

Answers

All replies