[Mono-bugs] [Bug 621366] System.DateTime converts NSDate to UTC

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jul 14 12:23:29 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=621366

http://bugzilla.novell.com/show_bug.cgi?id=621366#c3


--- Comment #3 from Neal Culiner <neal at nc-software.com> 2010-07-14 16:23:28 UTC ---
Thanks Miguel.  I'm using the methods below:

        public DateTime NSDateToDateTime(MonoTouch.Foundation.NSDate date)
        {
            return (new
DateTime(2001,1,1,0,0,0)).AddSeconds(date.SecondsSinceReferenceDate);
        }

        public MonoTouch.Foundation.NSDate DateTimeToNSDate(DateTime date)
        {
            return
MonoTouch.Foundation.NSDate.FromTimeIntervalSinceReferenceDate((date-(new
DateTime(2001,1,1,0,0,0))).TotalSeconds);
        }

I'll look at your suggestion but I'm concerned that the app will still have all
other UTC conversions (DateTime.UtcNow) incorrect because the "thread/culture"
doesn't have the proper information from the host.  Do you know of any way to
get a .NET app that's running to update its information for proper conversions?
 I haven't confirmed that the DateTime.UtcNow is incorrect but I'm assuming
it's all going to use the offset from when the app was first launched and hold
that until the app is killed manually.  I use this quite a bit in DataTables,
etc.

Thank you.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list