• 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: Carbon Date to NSDate - How?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Carbon Date to NSDate - How?


  • Subject: Re: Carbon Date to NSDate - How?
  • From: "John C. Randolph" <email@hidden>
  • Date: Mon, 25 Feb 2002 14:55:29 -0800

On Monday, February 25, 2002, at 11:20 AM, John Pattenden wrote:

I have a carbon app that sends a ulong date to my cocoa code, is there a simple way to convert from Carbon's date format to cocoas??

Depending on just what the epoch is for that unsigned long, assuming that value is seconds since the epoch, you can do it like this:

unsigned long carbonDate;
double interval = carbonDate;

NSDate myDate = [NSDate dateWithTimeIntervalSinceReferenceDate:interval];

or this:

NSDate myDate = [NSDate dateWithTimeIntervalSince1970:interval];

See which one works.

HTH,

-jcr


John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Carbon Date to NSDate - Here's How
      • From: John Pattenden <email@hidden>
References: 
 >Carbon Date to NSDate - How? (From: John Pattenden <email@hidden>)

  • Prev by Date: Re: application quit right after launching
  • Next by Date: Re: Very strange build errors (warning...long)
  • Previous by thread: Carbon Date to NSDate - How?
  • Next by thread: Re: Carbon Date to NSDate - Here's How
  • Index(es):
    • Date
    • Thread