I wanted to convet the string to date.
Date in string format is: 2016-09-12T09:52:39Z
(Without any space)
Most of the solutions which I found has atleast space in between date and time text. Which is not working in my case.
The major issue in converting above date format is that "T" and "Z". I think some how the date formatter is not distingushing date "dd" and timezone "T". I did attempted to format that but its not working.
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"];
NSDate *date = [[NSDate alloc] init];
date = [formatter dateFromString:datestring];
Any solution to convert such string into date?
Edit: I had mention while posting question is that - In most of question related to "converting string to date" has spaces in bettwen those text, So, You can write formatter according to that. In my case, There was no space between date and hour part & instead it has T. Hence, I was not able to convert the string date into date object, Instead I was getting null. For which I tried some solutions & after that I posted the question.