我有一個從服務器「2017年5月31日上午10時05分59秒+00:00」的日期字符串,我試圖把它轉換成NSDate的,DateFormatting導致空
NSString *expiration = [responseObject valueForKey:@".expires"];
NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.dateFormat = @"MM/dd/yyyy hh:mm:ss a +zz";
dateFormatter.timeZone = [NSTimeZone localTimeZone];
NSDate *expiryDate = [dateFormatter dateFromString:expiration];
EKLog(@"expiry date %@", expiryDate);
但給我null,Plase幫助謝謝。
https://gist.github.com/romaonthego/5138532這將幫助您日後格式化日期。 –