I have a string that contain date:
2012-05-25
and i wan to convert this string to NSDate:
NSString *birthday = /*2012-05-25*/;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-DD"];
NSDate *dateFromString = [dateFormatter dateFromString:birthday];
and in the dateFromString i get the date of today.
This works :
Outputs :
Please refer to the Apple guide for details.