Re: Getting local timezone as integer
Re: Getting local timezone as integer
- Subject: Re: Getting local timezone as integer
- From: Deborah Goldsmith <email@hidden>
- Date: Mon, 13 Mar 2006 15:24:44 -0800
Yes, it would be too obvious: if you use timeZoneForSecondsFromGMT,
you will not get back the same time zone. In other words:
[NSTimeZone timeZoneForSecondsFromGMT: [zone secondsFromGMT]]
does not return an NSTimeZone identical to "zone". In particular, it
will not observe Daylight Savings Time. This kind of idiom is OK if
you want a time zone to use and then throw away. However, if you plan
on keeping it and using it later -- even one minute later -- it's not
going to work.
If you want to keep a persistent identifier for a time zone, you need
to get its ID, not its offset from GMT. Offset from GMT is not
sufficient to identify a time zone. This will work:
[NSTimeZone timeZoneWithName: [zone name]]
Deborah Goldsmith
Internationalization, Unicode liaison
Apple Computer, Inc.
email@hidden
On Mar 11, 2006, at 12:59 PM, Matt Neuburg wrote:
On Sat, 11 Mar 2006 20:56:27 +0100, Torsten Trautwein
<email@hidden> said:
A NSTimeZone can be set by with timeZoneForSecondsFromGMT. But how
can I
get the user\s timezone in seconds from GMT?
I tried to simply create an NSCalendarDate, but I can't find a way to
get the seconds
from GMT from it. I do only get a NSTimeZone, which is not very
comfortable for me.
I don't know, but secondsFromGMT *can't* be the answer. That would
be too
obvious. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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
_______________________________________________
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