Ok I feel kind of dumb asking this, but any idea why this is not working:
{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"mmmm dd, yyyy"];
NSDate *myDateFromString = [formatter dateFromString:creditDate.text];
NSLog(@"%@", myDateFromString);
[self.credit setCertificationDate: myDateFromString];
}
It returns null
Format and string don't match because "m" is minute and "M" is month. So "August 18 2012" can't be interpreted, take "MMMM dd yyyy" instead You can check formats at unicode.org
I always set a locale explicitly:
As long as you don't parse month names, it doesn't matter if your real locale is en_US if supplying an explicit format string.
Some more hints: