I am attempting to format an NSString which looks like:
@"2012-07-19T02:58:33Z"
to an NSDate with the following format:
@"MMMM dd, yyyy HH:mm a"
The NSDateFormatter always returns nil and I think it is because it cannot convert the NSString in it's current format to the desired one. Here is my code:
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"MMMM dd, yyyy HH:mm a"];
NSLocale *enUSLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[formatter setLocale:enUSLocale];
NSDate *date = [formatter dateFromString:dateString];
Do I need to store the date in a differant format? Can I make this conversion possible with the current NSString?
Thanks!