简体   繁体   English

Excel日期值时区是否具体?

[英]Is Excel date value time zone specific?

In Excel, date are stored as an integer value, which is the number of days since Jan 1, 1900. For example, '1/1/1970' is stored as 25569. 在Excel中,日期存储为整数值,这是自1900年1月1日以来的天数。例如,“1/1/1970”存储为25569。

Question #1: Unlike Javascript datetime, which references a UTC time (ie, UNIX epoch time), Excel date definition doesn't mention the timezone of "Jan 1, 1900". 问题#1:与引用UTC时间(即UNIX纪元时间)的Javascript datetime不同,Excel日期定义未提及“1900年1月1日”的时区。 Is the reference time 'Jan 1, 1900' not specific to any time zone? 参考时间'1900年1月1日'不是特定于任何时区吗?

Question #2: I used multiple methods to calculate the days elapsed between 'Jan 1, 1970' and 'Jan 1, 1900', the result is 25567. However, in Excel 'Jan 1, 1970' is stored as 25569 (2 more days than what it should be'. Did I miss something? 问题2:我使用多种方法计算'1970年1月1日'和'1900年1月1日'之间的天数,结果是25567.但是,在Excel'1970年1月1日'中存储为25569(另外2个天比我应该'。我错过了什么?

1: Excel's date/time is in terms of the local time on the computer. 1:Excel的日期/时间以计算机上的本地时间表示。 It does NOT use the timezone information. 它不使用时区信息。 To obtain timezone information in Excel requires Windows API calls. 要在Excel中获取时区信息,需要Windows API调用。

2: Count starts at one (1-Jan-1900 = 1 ) 2:计数从1开始(1月1日 - 1900 = 1

Excel include the non-existent 29-Feb-1900. Excel包括不存在的29-Feb-1900。 See: Excel incorrectly assumes that the year 1900 is a leap year 请参阅: Excel错误地假定1900年是闰年

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM