I am trying to get NSDate in the format: 05/20/2012 10:30 PM
here is the code i have. [dateFormat setDateFormat:@"YYYY-MM-dd\'T\'HH:mm:ssZZZZZ"]; this works, but the format is not like 05/20/2012 22:30 displays the date in the format: 12-03-2013 12:00:00 +00: 00: 00
and then when I use:
[dateFormat setDateFormat:@"MM/dd/yyyy"]; I get a null return value instead of a formatted date.
// timestamp conversion NSString *str = [timeStamp objectAtIndex:indexPath.row]; // convert to date NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; // [dateFormat setDateFormat:@"YYYY-MM-dd\'T\'HH:mm:ssZZZZZ"]; [dateFormat setDateFormat:@"MM/dd/yyyy"]; NSDate *dte = [dateFormat dateFromString:str]; cell.timeStampLabel.text = [NSString stringWithFormat:@"%@",dte ];
str original string output before formatting str 2013-08-23T15:21:19+02:00
thanks for any help
source share