iPhone SDK Objective-C __DATE__ (compile date) can't be converted to an NSDate

Posted by Janice on Stack Overflow See other posts from Stack Overflow or by Janice
Published on 2010-05-19T02:24:50Z Indexed on 2010/05/19 2:30 UTC
Read the original article Hit count: 299

//NSString *compileDate = [NSString stringWithFormat:@"%s", __DATE__];
NSString *compileDate = [NSString stringWithUTF8String:__DATE__];

NSDateFormatter *df = [[[NSDateFormatter alloc] init] autorelease];

[df setDateFormat:@"MMM d yyyy"];   
//[df setDateFormat:@"MMM dd yyyy"];    

NSDate *aDate = [df dateFromString:compileDate];  

Ok, I give up. Why would aDate sometimes return as nil?

Should it matter if I use the commented-out lines... or their matching replacement lines?

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about date