Re: Re: Re: Re: NSCalendarDate saving and loading to get the same date-time
Re: Re: Re: Re: NSCalendarDate saving and loading to get the same date-time
- Subject: Re: Re: Re: Re: NSCalendarDate saving and loading to get the same date-time
- From: "Sarat Kongara" <email@hidden>
- Date: Mon, 9 Oct 2006 14:09:09 -0700
Thanks Shawn. I understand the NSDate behaviour better now. I guess
the best option for me is to save the Timezone with the dates so I can
adjust them on load or save the components individually
(mm,dd,yyyy,hh,mm,ss).
Regards
Sarat
On 10/9/06, Shawn Erickson <email@hidden> wrote:
On 10/9/06, Sarat Kongara <email@hidden> wrote:
> > 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.
>
> Yes, this I understand. But I was wondering why saving the value from
> [date timeIntervalSinceReferenceDate] and recreating a new date using
> [NSDate dateWithTimeIntervalSinceReferenceDate] returns different
> date-time when different timezones are set during Save and Load.
> Shouldn't the date-time be the same for all timezones when you are
> calculating it from a absolute elapsed time from a reference date?
When you ask NSDate for date/time information it is giving you a time
zone adjusted interpretation of itself.
Time interval since reference date is defined to be "The interval
between the system's absolute reference date (the first instant of 1
January 2001, GMT) and the current date and time". It is expressed in
terms of GMT but once you create an NSDate from this value then that
NSDate instant will return you time information relative to the
current time zone of the system (unless you use API that supplies time
zone).
-Shawn
_______________________________________________
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