Closed JamoCA closed 1 year ago
As you say, Excel (and therefore POI) can't handle pre-1900 date values as dates. So you'll need to either convert your query column to text pre-export, or use the datatypes
argument to force the column to string
when outputting.
If you need to allow sorting by date, then maybe you could split out the values into separate year, month and day query columns?
I did consider your suggestion of having the library auto-detect 1900 dates and set them as strings, but unfortunately that would break the library's ability to detect time-only values in ACF, which always include the epoch date 1899-12-30
.
I'm exporting history-related data from SQL Server, but Excel is only capable of using dates between 1/1/1900 and 12/31/9999.
https://en.wikipedia.org/wiki/Year_1900_problem
This is how Excel renders pre-1900 dates.
What's the best practice for handling the outputting of these dates using POI? Can it be automated or would a column have to be explicitly set to text with all values pre-transformed? Thanks.