Re: NSCalendarDate saving and loading to get the same date-time
Re: NSCalendarDate saving and loading to get the same date-time
- Subject: Re: NSCalendarDate saving and loading to get the same date-time
- From: Uli Kusterer <email@hidden>
- Date: Mon, 9 Oct 2006 21:41:45 +0200
Am 09.10.2006 um 21:28 schrieb Sarat Kongara:
I have a NSDictionary with a couple of NSCalendarDate objects as
values, I save and load the dictionary to a plist file (using
NSDictionary writeToFile... and NSDictionary
dictionaryWithContentsOfURL... methods).
Say I set the date-time to Oct 9th, 2006 10:30 AM (My timezone is set
to New York in System Preferences) and save the dictionary. I change
my timezone to San Francisco (In System Preferences) and load the
dictionary the date-time is Oct 9th, 2006 7:30 AM.
Is there a way to make sure the date-time is the same value (same
mm-dd-yyyy hh:mm:ss ) after save and load even if the timezone is
changed.
Save the time zone relative to which you specified your time and
restore it later, or query the OS for the time difference and save
that along with the date so you can adjust for it?
It *is* the exact same time, just expressed in another time zone
(i.e. when it's 2:30 in the US, it's about 11:30 in central Europe).
The time zone doesn't change the date, it changes how it is
displayed. So none of the things you observed is in any way surprising.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden