Cocoa touch NSDateFromString,解析过去的日期
我正在执行此代码以解析日期1800年1月1日:Cocoa touch NSDateFromString,解析过去的日期,cocoa-touch,date,date-parsing,Cocoa Touch,Date,Date Parsing,我正在执行此代码以解析日期1800年1月1日: NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"ddMMyyyy"]; NSDate *date = [formatter dateFromString:@"01011800"]; 当我用 NSLog(@"%@", date); 我明白了 我的预期结果是1799-12-31 23:00:00+0000:我在中欧,在1月
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"ddMMyyyy"];
NSDate *date = [formatter dateFromString:@"01011800"];
当我用
NSLog(@"%@", date);
我明白了
我的预期结果是
1799-12-31 23:00:00+0000
:我在中欧,在1月1日,我对UTC有1.00小时的偏移量,但我不明白这10分4秒是从哪里来的。在互联网上仔细看看过去几百年来你们地区的时区变化。打赌结果实际上是正确的,在1800年,你的本地时区偏离了10分4秒
对于1800年的日期,苹果显然没有使用今天的时区信息,而是214年前的时区信息 我相信苹果的计算结果是好的。我只是想了解这些数据是从哪里来的
1799-12-31 23:10:04 +0000