我存储了一个 NS 日期,记录为
2013-03-15 00:00:01 +0000
我认为 +0000 是 UTC 时间。但是,当我尝试
NSCalendar* theCalendar = [NSCalendar currentCalendar];
unsigned theUnitFlags = NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
NSDateComponents* compsForDate = [theCalendar components:theUnitFlags fromDate:compDate];
组合记录为:
<NSDateComponents: 0xc0537b0>
Calendar Year: 2013
Month: 3
Leap month: no
Day: 14
Hour: 20
Minute: 0
Second: 1
Weekday: 5
我会假设这一天是 15 小时,小时是 0,因为我认为没有与这个日期相关的时区。谁能告诉我哪里出错了?