• 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: NSCalendar date calculation anomaly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCalendar date calculation anomaly


  • Subject: Re: NSCalendar date calculation anomaly
  • From: Scott Ribe <email@hidden>
  • Date: Tue, 27 Apr 2010 22:18:57 -0600

Digging under the covers:

CFGregorianUnits gu = { 0, 0, numdays, 0, 0, 0 };
CFAbsoluteTime at = CFAbsoluteTimeAddGregorianUnits( 0, NULL, gu );
cd = [NSDate dateWithTimeIntervalSinceReferenceDate: at];
NSLog( @"date 4: %@", [cd description] );

Produces: "date 4: 2010-05-04 18:00:00 -0600", which is at least the right moment in time, even though it is not displayed correctly.

While trying to use the time zone explicitly:

CFGregorianUnits gu = { 0, 0, numdays, 0, 0, 0 };
CFAbsoluteTime at = CFAbsoluteTimeAddGregorianUnits( 0, CFTimeZoneCopySystem(), gu );
cd = [NSDate dateWithTimeIntervalSinceReferenceDate: at];
NSLog( @"date 4: %@", [cd description] );

Produces: "date 4: 2010-05-04 17:00:00 -0600", which is wronger ;-)




--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice




_______________________________________________

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

References: 
 >NSCalendar date calculation anomaly (From: Scott Ribe <email@hidden>)

  • Prev by Date: NSCalendar date calculation anomaly
  • Next by Date: Re: NSCalendar date calculation anomaly
  • Previous by thread: NSCalendar date calculation anomaly
  • Next by thread: Re: NSCalendar date calculation anomaly
  • Index(es):
    • Date
    • Thread