date-to-xlsx
Returns the Excel representation of the date value extracted from the source, as a serial number that represents the date. By default, in Microsoft Excel for Windows, January the 1st, 1900 is serial number 1.
Languages
Built-in, C#, Java, XSLT 2.0, XSLT 3.0.
Parameters
Name | Type | Description |
---|---|---|
date | xs:date | The input date value. |
Example
The following mapping converts the string "1900-01-01" to a date, with the help of the parse-date function. The obtained xs:date value (January the 1st, 1900) is then supplied as argument to the date-to-xlsx function, which returns its numerical representation and writes it to an Excel cell. The resulting cell value is 1, as expected.
Note that the format of the target Excel cell is "Numeric". If you right-click the cell in Excel and format it as a date using the Format Cells command, the cell value becomes 1/1/1900.