According to the ECMA-376, Second Edition, Part 1 - Fundamentals And Markup Language Reference SpreadsheetML supports date serial values with three possible compatibility settings and various ranges.
- In the 1900 date base system, the lower limit is January 1, -9999, which has serial value -4346018. The base date for this date base system is December 30, 1899, which has a serial value of 0.
- In the 1900 backward compatibility date-base system, the lower limit is January 1, 1900, which has serial value 1. The base date for this date base system is December 31, 1899, which has a serial value of 0.
- In the 1904 backward compatibility date-base system, the lower limit is January 1, 1904, which has serial value 0. The base date for this date base system is January 1, 1904, which has a serial value of 0.
However, when I use Microsoft Office Excel 2010 to generate a *.xlsx file with a date serial of 1, the *.xlsx file does not have any dateCompatibility
attribute set (indicating "1900 date base system") but the date associated with date serial 1 is January 1, 1900 (indicating "1900 backward compatibility").
The workbookPr element is this, unedited, no dateCompatibility
attribute.
<x:workbookPr defaultThemeVersion="124226" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" />
And here is a row of data that shows a date serial of 1 and the text result of formatting it as a date:
<x:row r="3" spans="1:2">
<x:c r="A3">
<x:v>1</x:v>
</x:c>
<x:c r="B3" t="str">
<x:f t="shared" si="0" />
<x:v>1900-01-01 00:00:00.0</x:v>
</x:c>
</x:row>
the formula is just date formatting, referenced earlier in the worksheet:
<x:f t="shared" ref="B1:B42" si="0">TEXT(A1, "yyyy-mm-dd HH:mm:ss.0")</x:f>
This formula gives the same result as applying a date format pattern to the date serial number, demonstrated in the below screen shot.
Also formatting negative dates results in an error, another indicator that Excel is actually using backwards-compatible date system despite the absence of the dateCompatibility
attribute on workbookPr
.
The options for the workbook only show an unchecked checkbox for 1904 date system. I don't see any option for 1900 date based vs. 1900 backwards-compatibility.
Am I reading the spec wrong? Or the SpreadsheetML? Or something else?