开发者

Excel parse produces 40802 for date 16-Sep-11

I found a PHP script that parses excel files, but there seems to be some kind of numbering system or encoding that is associated with dates. For example, the original .xls spreadseets contains this date in this format:

16-Sep-11

However, the information that is parsed by the script shows the following integer to represent this date:

40802

If someone could help me by identifying what representation i开发者_高级运维s being used for the date, then I think I can figure out how to do the conversion.


Depending on the properties of the file in question, Excel uses one of two incompatible formats to store dates, the "1900" system and the "1904" system. By default, a file that originated on Windows will use the "1900" system, while a file that originated on a Mac will use the "1904" system. In the 1900 system, the number stored is the number of days elapsed since 1 Jan 1900, while in the 1904 system, the number stored is the number of days elapsed since 1 Jan 1904. There are various historical reasons (or is that hysterical raisins?) why Excel uses the two formats. Times are also stored in a similar manner, with the integer part being the date and the fractional part being the portion of the day that has passed.

Here is a Microsoft Knowlegebase article with more information: http://support.microsoft.com/kb/214330


Excel dates are based on the number of days from Jan 1, 1900. This page provides good detailed information on the quesiton.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜