How can i convert the following date "Sun Jul 17 07:48:34 +0000 2011" to the following format "2011-07-17 07:48:34"?
I used NSDateFormatter
as shown below but it didnt work. It gives null as a result.
NSDateFormatter *objDateFormatter = [[NSDateFormatter alloc] init];
[objDateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
[objDateFormatter dateFromString:sDate];
See Question&Answers more detail:os