问题
I might missing something, but I can't compose proper date formatter string for the date:
2016-01-14T10:24:26+0000
What is 'T' here? and how to include timezone?
My string does not work: @"yyyy-MM-dd'T'hh:mm:ss Z"
回答1:
You have to use 'T' in single quotes like below format to retrive string ftom date:
yyyy-MM-dd'T'hh:mm:ssZ
Let me know.
回答2:
NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'";
NSDate *yourDate = [dateFormatter dateFromString:myString];
来源:https://stackoverflow.com/questions/34765304/date-formatter-for-a-certain-format-of-date