• 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 NSTimeZone for a given NSDate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting NSTimeZone for a given NSDate


  • Subject: Re: Getting NSTimeZone for a given NSDate
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Mon, 15 Sep 2008 11:35:38 +0200


Le 15 sept. 08 à 09:56, Jason Coco a écrit :


On Sep 15, 2008, at 03:49 , Markus Spoettl wrote:

Hi List,

I just know it must be there but I can't see it. How can I get to the NSTimeZone for a given NSDate. When using -description: the date got a time zone, so it's stored in there but how on earth can I get to it? I only need the GMT offset (numerically, not as string), in case there's a simpler way to obtain this.

All NSDate objects are stored as seconds since the reference date (Jan 1 1970 00:00 GMT) and so are always GMT. The description is using the default time zone to adjust the date. You can get the default time zone with [NSTimeZone defaultTimeZone] and then you can get the offset with -(NSTimeInterval)secondsFromGMT.

It's conceptualy right, but just for info, NSDate do not store the value as a UNIX timestamp, but as a Core Foundation Absolute Time which is a double that represents the number of seconds since the reference date which is 00:00:00 1 January 2001



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Getting NSTimeZone for a given NSDate
      • From: Jason Coco <email@hidden>
References: 
 >Getting NSTimeZone for a given NSDate (From: Markus Spoettl <email@hidden>)
 >Re: Getting NSTimeZone for a given NSDate (From: Jason Coco <email@hidden>)

  • Prev by Date: Re: Getting NSTimeZone for a given NSDate
  • Next by Date: Re: Getting NSTimeZone for a given NSDate
  • Previous by thread: Re: Getting NSTimeZone for a given NSDate
  • Next by thread: Re: Getting NSTimeZone for a given NSDate
  • Index(es):
    • Date
    • Thread