Return to Snippet

Revision: 24230
at February 23, 2010 23:52 by espinallab


Initial Code
NSString *dateStr = @"20100223";

// Convert string to date object
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyyMMdd"];
NSDate *date = [dateFormat dateFromString:dateStr];  

// Convert date object to desired output format
[dateFormat setDateFormat:@"EEEE MMMM d, YYYY"];
dateStr = [dateFormat stringFromDate:date];  
[dateFormat release];

Initial URL
http://stackoverflow.com/questions/2311421/convert-string-to-nsdate

Initial Description

                                

Initial Title
Date from String

Initial Tags

                                

Initial Language
Objective C