• 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: NSDate vs. CFDate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDate vs. CFDate


  • Subject: Re: NSDate vs. CFDate
  • From: Malte Tancred <email@hidden>
  • Date: Thu, 27 Jun 2002 15:48:50 +0200

On thursday, june 27, 2002, at 03:09 , Jim Menard wrote:
I store an NSDate into a preferences file and it gets stored as

<date>2002-05-01T04:00:00Z</date>

When I read it back out, a CFDate (or NSCFDate) object gets created, not an
NSDate as I would like.

How do I create an NSDate from a NSCFDate? I can't find NSCFDate in the
headers anywhere. Do I have to call something like CFDateGetAbsoluteTime
and pass that time to some NSDate constructor?

An NSCFDate is a subclass of NSDate i believe. Try [theNSCFDateInstance isKindOfClass:[NSDate class]]. It should return YES.

Try this:

#import <Foundation/Foundation.h>

int main() {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDate *date = [NSDate dateWithString:@"2002-06-27 13:13:13 +0000"];

NSLog(@"date: %@: %@", [date class], date);

if ([date isKindOfClass:[NSDate class]]) NSLog(@"Yes way Ted!");

NSLog(@"superclass: %@", [date superclass]);

[pool release];
}

Cheerio,
Malte
_______________________________________________
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: NSDate vs. CFDate
      • From: Lance Bland <email@hidden>
References: 
 >NSDate vs. CFDate (From: Jim Menard <email@hidden>)

  • Prev by Date: Re: Quartz/memory benchmarks...
  • Next by Date: Re: NSDate vs. CFDate
  • Previous by thread: NSDate vs. CFDate
  • Next by thread: Re: NSDate vs. CFDate
  • Index(es):
    • Date
    • Thread