Bug 65703 - DataFormatter optional mode that modifies date formats with 2 digit years to 4 digit years
Summary: DataFormatter optional mode that modifies date formats with 2 digit years to ...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 5.0.x-dev
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-25 05:24 UTC by PJ Fanning
Modified: 2021-11-25 13:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description PJ Fanning 2021-11-25 05:24:15 UTC
This would be optional but would help in scenarios like https://stackoverflow.com/questions/42259859/java-excel-to-csv-date-conversion-issue-with-apache-poi/42285272#42285272

XSLX is ok with 2 digit year formats because we have the raw date in number format. If someone uses XLSX2CSV to write data to CSV then the formatted date in the CSV is all that's kept. 

DataFormatter already has an emulateCSV option - maybe this could be used to control the optional behaviour to modify the date format to have 4 digits in the year. Alternatively, we can add a new parameter.
Comment 2 PJ Fanning 2021-11-25 12:46:42 UTC
Added r1895326 - DataFormatter now has a setUse4DigitYearsInAllDateFormats(boolean) method with default of false