格式化一個NSDate我想從一個字符串創建一個NSDate:錯誤從字符串
NSString *mostRecentMentionMessageTimestamp = [mostRecentMessage valueForKey:@"updated_at"];
NSLog(@"%@",mostRecentMentionMessageTimestamp);
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
NSDate *mostRecentMentionDate = [dateFormatter dateFromString:mostRecentMentionMessageTimestamp];
NSLog(@"%@",mostRecentMentionDate);
當我打印我的字符串是: 2011-11-10T07:22:59Z
後我從字符串打印日期並打印它,它是(null)
我在做什麼錯?
可能重複(http://stackoverflow.com/questions/2504992/how-to-convert-a-utc-date-to-nsdate ) –