• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting local timezone as integer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Re: Getting local timezone as integer (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)?
  • Next by Date: Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)?
  • Previous by thread: Re: Getting local timezone as integer
  • Next by thread: NSLog(@"%@",[NSProxy class]);
  • Index(es):
    • Date
    • Thread