Re: Dates and time zones
Re: Dates and time zones
- Subject: Re: Dates and time zones
- From: Rory Prior <email@hidden>
- Date: Sun, 12 Dec 2004 13:08:24 +0000
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
_______________________________________________
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