更新时间:2023-10-01 23:44:10
因此,与其添加我使用过的24小时时间间隔..
So rather than adding a time interval of 24 hours I have used ..
+ (NSDate *) addOneDayToDate: (NSDate *) date {
return [currentCalendar dateByAddingComponents:oneDay toDate:date options:0];
}
其中
oneDay = [[NSDateComponents alloc] init];
[oneDay setDay:1];
currentCalendar = [NSCalendar currentCalendar];
在大多数情况下,这是可行的,除非日期在午夜到时钟通常在凌晨2:00之间更改的时间.不需要逻辑,因为日期时间将在此之后.
This works in most cases unless the date is between midnight and the time the clocks change usually around 2:00am. Have not needed logic for this since the date times will be after this.