NSLog(@"Time From DB %@", mytime.beginTime);
NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
[timeFormatter setDateFormat:@"hh:mm a"];
UILabel *timeLabel = (UILabel *)[cell viewWithTag:1];
timeLabel.text = [timeFormatter stringFromDate:mytime.beginTime];
NSLog(@"Time after formatting %@", timeLabel.text);
[timeFormatter release];
Console
2011-07-05 11:16:09.331 My project[1907:207] Time From DB 2011-05-10 13:54:09 +0000
2011-07-05 11:16:09.331 My project[1907:207] Time after formatting 04:54 PM
Why are the times different? How to fix that?
It is using the user’s time zone (default). If you want it in GMT, you will have to set the time zone of the date formatter.
BTW Times aren’t different. Time is the same but is being represented in different time zones.