0

我正在使用 NSDateFormatter 将字符串转换为 NSDate

1 NSDateFormatter *df = [[NSDateFormatter alloc]init];
2 [df setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
3 [df setDateFormat:@"YYYY-MM-dd"];
4 NSDate *dueDate = [df dateFromString:@"1970-01-01"];

当我检查到期日期时,它错了一年:

po dueDate
(NSDate *) $0 = 0x1cdc08d0 1971-01-01 00:00:00 +0000

我做错了吗,或者这可能与“请勿打扰”功能中的错误相同?

http://www.forbes.com/sites/adriankingsleyhughes/2013/01/03/apples-ios-6-do-not-disturb-bug-means-your-iphone-wont-disturbed-you-until-next-星期/

4

0 回答 0