I'm trying to get date asNSString
. I'm receiving date in the format 2017-05-05T04:42:44.954604Z
Below is the code in which I'm trying to apply NSDateFormatter
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSString *newdate = [utcDate stringByReplacingOccurrencesOfString:@"T" withString:@" "];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.Z"];
msgDate = [dateFormatter dateFromString:newdate];
But msgDate
is showing nil