I am getting NSString 2012-08-17T10:56:45.508205 as time from Django API. 
I am trying to convert that string into NSDate object with this code:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
[dateFormatter setTimeZone:timeZone];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"];
NSDate *date = [dateFormatter dateFromString:stringToConvert];
But date object is null. Where am I going wrong?
The ISO8601 string you're getting from the Django API (2012-08-17T10:56:45.508205) does not include a time zone component. However, you are including that field symbol (Z) in your format string. Just remove that and it should work fine.
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"];
See the Unicode Technical Reference for more information on the formatting codes:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With