hi, it is possible to convert in iphone sdk (obj-c) a string to nsdate. thank you
+4
A:
You'll want to take a look at NSDateFormatter. Determine the format of the date string and then use dateFromString:
to convert the string to an NSDate object.
Giao
2010-02-22 14:27:55
+2
A:
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];
Hope this will help you.
Suresh Kumar
2010-02-23 03:53:17