dateWithTimeIntervalSinceNow给出愚蠢的答案

And*_*rew 0 iphone cocoa-touch objective-c nsdate

所以这是我得到的代码:

NSDate *myCustomDate = [NSDate dateWithTimeIntervalSinceNow:10];
NSLog(@"My custom date: %@", myCustomDate);
Run Code Online (Sandbox Code Playgroud)

它返回:My custom date: 0023-01-23 18:37:17 +0000.

为什么今年会给出一个愚蠢的答案,而不是2011年?其他一切都是正确的.

Mat*_*uch 5

您的设备正在使用日历.

转到设置/国际/日历并更改回格里高利历.