I have the following code to parse a date from string:
NSString * str = @"8/13/2010 1:59:00 PM";
NSDateFormatter * dateFormat2 = [[NSDateFormatter alloc] init];
[dateFormat2 setDateFormat:@"MM/dd/yyyy h:mm:ss a"];
NSDate * orderDate = [dateFormat2 dateFromString:str ];
but orderDate is always coming up null, what am i doing wrong ? What is the proper dateFormatString ?
This works fine in the emulator but is null on iphone 4 ios 4.0
using this fix from @Liam ‘s comment helped me fix this, i’m just posting in case its helpful to someone else,
i realized this bug i found only happens when the iphone user sets their clock to the 24 hour military time,