I am trying to convert an NSString to an NSDate with time. Here’s what I’m doing now:
NSString *myDateIs= @"2012-07-14 11:30:40 AM ";
NSDateFormatter* startTimeFormat = [[NSDateFormatter alloc] init];
[startTimeFormat setDateFormat:@"YYYY-MM-dd hh:mm:ss a "];
NSDate*newStartTime = [startTimeFormat dateFromString:myDateIs];
The output is 2012-07-14 06:00:40 +0000. The date is correct but the time is not correct.
How can I get the correct time?
Thanks.
The time you are getting is in GMT convert it into local time.