【发布时间】:2014-01-24 14:29:31
【问题描述】:
我现在如何从 NSDate 中减去 100 年?
我有这个:
NSDate *now = [NSDate date];
NSDate *hundredYearsAgo = [now dateByAddingTimeInterval:100*365*24*60*60];
但这并没有考虑到有 365 天的年份和有 366 天的年份。
【问题讨论】:
-
你研究过
NSDateComponents吗?
标签: objective-c nsdate