我不知道如何将特殊的日期字符串转换为 NSDate。我有的:
NString * dateStr = @"2013-06-10T18:21:37";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss"];
NSDate * dateD = [formatter dateFromString:dateStr];
NSTimeInterval interval = [dateD timeIntervalSinceDate:[NSDate date]];
也试过:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss"];
没有运气。
我怎么能解决这个问题?