How to convert the Date String “2012-05-03 06:03:00 +0000” to NSDate. I user the code below, but it does not work:
NSDateFormatter *datFormatter = [[NSDateFormatter alloc] init];
[datFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss Z"];
NSDate* date = [datFormatter dateFromString:dateStr];
This code prints
date: 2012-05-03 09:03:00 +0300It works. Also don’t forget to set the date formatter’s timeZone that you’re targeting