相同數量我沒有建立一個自定義日曆,當我經過一週改變了一天的日數,我看到了奇怪的情況時的日期是26日,但NSDateFormatter和NSDateComponents返回27,同樣是27 = 27,你可以看到一個日誌。在另一種情況下,31是30,而1是31NSDateFormatter或NSDateComponents返回不同的日期
有誰有這樣的事情嗎?
for (NSDictionary *dict in weekViews) {
UILabel *dayName = dict[@"dayName"];
UILabel *dayNumber = dict[@"dayNumber"];
components = [calendar components:NSCalendarUnitMonth | NSCalendarUnitDay fromDate:tempDate];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"dd";
//TODO:Remove NSLog
NSLog(@"%@ = %@", [formatter stringFromDate:tempDate], tempDate);
dayName.text = [NSString stringWithFormat:@"%@", weekDaySymbols[index++]];
dayNumber.text = [NSString stringWithFormat:@"%d", components.day];
tempDate = [tempDate dateByAddingTimeInterval:86400];
}
2013年10月22日01:06:25.812護理[539:70B] 27 = 2013年10月26日21點00分零零秒0000
2013年10月22日01:06: 25.813護理[539:70b] 27 = 2013-10-27 21:00:00 +0000
2013-10-22 01:06:25.813護理[539:70b] 28 = 2013-10-28 21: 00:00 0000
2013年10月22日01:06:25.814護理[539:70B] 29 = 2013年10月29日21點00分00秒0000
2013年10月22日01: 06:25.814關心[539:70B] 30 =二○一三年十月三十○日二十一點○○分00秒0000
2013年10月22日01:06:25.815護理[539:70B] 31 = 2013年10月31日21時:00 0000
2013年10月22日01:06:25.816護理[539:70B] 01 = 2013年11月1日21點00分00秒0000
該代碼的另一個例子:
2013-10-22 01:14:12.456護理[539:70b] 22 = 2014-03-22 21:00:00 +0000
2013-10-22 01:14:12.456護理[539: 70b] 23 = 2014-03-23 21:00:00 +0000
2013年10月22日01:14:12.457護理[539:70B] 24 = 2014年3月24日21時00分00秒0000
2013年10月22日01:14:12.457護理[539 :70B] 25 = 2014年3月25日21點00分○○秒0000
2013年10月22日01:14:12.458護理[539:70B] 26 = 2014年3月26日21點00分○○秒+ 0000
2013年10月22日01:14:12.458護理[539:70B] 27 = 2014年3月27日21時00分○○秒0000
2013年10月22日01:14:12.459護理[539:70b] 28 = 2014-03-28 21:00:00 +0000
2013-10-22 01:12:34.942護理[539:70b] 29 = 2014-03-29 21:00:00 +0000
2013-10-22 01:12:34.943護理[539: 70B] 31 = 2014年3月30日21時00分○○秒0000
2013年10月22日01:12:34.943護理[539:70B] 01 = 2014-03-31二十一點00分00秒0000
2013年10月22日01:12:34.944護理[539:70B] 02 = 2014年4月1日二十一時00分00秒0000
2013年10月22日01:12:34.944護理[ 539:70b] 03 = 2014-04-02 21:00:00 +0000
2013 -10-22 01:12:34.945護理[539:70B] 04 = 2014年4月3日21點00分00秒0000
2013年10月22日1點12分三十四秒。945護理[539:70B] 05 = 2014年4月4日21:00:00 +0000
我沒有打破我的大腦:)
時區!!!!!! –
(夏令時何時結束/從哪裏開始?) –
(如果您不知道,烏克蘭的「夏令時」在10月的最後一個星期日結束,並在3月的最後一個星期日再次開始。) –