Skip navigation.
 
mlRe: Dates and time zones
FROM : Rory Prior
DATE : Sun Dec 12 14:08:24 2004

Hi,

On 12 Dec 2004, at 2:20 am, Jonathan Jackel wrote:

> I notice your e-mail address is in the UK.  Perhaps that explains your
> observation.
>
> When I create a date with [[NSDate alloc]
> initWithTimeIntervalSinceReferenceDate:3600] and get its description,
> I see "2000-12-31 20:00:00 -0500", in other words, 8pm in the Eastern
> time zone, which is the time zone my Mac is set to use.  If I do this
> instead:
>
> NSLog(@"%@", aDate);
>
> I get "<CFDate 0x596000 [0xa01900e0]>{time = 3600}"
>
> Which suggests that the NSDate is really a CFDate, and all it keeps
> track of is the time interval -- not the time zone.
>
> Also, the documentation says nothing about time zone behavior, so I
> wouldn't count on anything beyond the fact that the NSDate represents
> a point in time.


I assumed the date would use GMT as the time zone because the
documentation states:

"Creates and returns an NSDate set to a specified number of seconds,
seconds, from the absolute reference date (the first instant of 1
January 2001, GMT). Use a negative argument to specify a date and time
before the reference date."

> NSCalendarDate is a subclass of NSDate, so
> dateWithNaturalLanguageString: works there as well.  Then you just
> setCalendarFormat: and you've got a nice looking date.  I was unable
> to get it to recognize a time zone abbreviation, however.


Oops I completely overlooked that, thanks for pointing it out :)

Cheers,

Rory
--

ThinkMac Software
http://www.thinkmac.co.uk

Related mailsAuthorDate
mlDates and time zones Rory Prior Dec 10, 18:45
mlRe: Dates and time zones Jonathan Jackel Dec 11, 19:04
mlRe: Dates and time zones Rory Prior Dec 12, 01:27
mlRe: Dates and time zones Jonathan Jackel Dec 12, 03:20
mlRe: Dates and time zones Rory Prior Dec 12, 14:08