[mono-android] DateTime.Now broken?

Nikolai Sander nikolai at eodsoft.com
Tue Mar 29 23:48:02 EDT 2011


When I get DateTime.Now Kind is System.DateTimeKind.Local but the hour is -7 hours off, which means it really is in UTC (device is set to PST).

TimeZoneInfo.Local returns PST correctly. 

As a workaround I tried the following:

            DateTime nowutc = new DateTime(DateTime.Now.Ticks, DateTimeKind.Utc);
            DateTime now = TimeZoneInfo.ConvertTimeFromUtc(nowutc, TimeZoneInfo.Local);

however now.Hour is identical to nowutc.Hour after the conversion and both are UTC-7 h

Bug? Am I missing something?

Thanks!
Nikolai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110329/fb59a80b/attachment.html 


More information about the Monodroid mailing list