我不知道 2 个 NSDate 之间到底有多少年。(当前日期和日期选择器日期)
我正在使用 NSTimeInterval (seconds) 如何使它达到几年?
此代码将使值为 Years:
NSTimeInterval distanceBetweenDates = [now timeIntervalSinceDate:date];
double secondsInAnYear = 31536000;
double YearsBetweenDates = distanceBetweenDates / secondsInAnYear;
NSString *dateString = [NSString stringWithFormat:@"%f", YearsBetweenDates];
labelView.text = dateString;
但我只得到 6 位小数!
我想要超过 6 位小数。如何?