I would close this topic as a duplicate, but I can’t decide which other topic to choose (there are so many questions asking for the same), so here is an answer:
formatter2.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss";
1
solved Converting NSString to NSDate gives nil [duplicate]