Bug 46411 - Formatting of Excel date values < 1.0 show different date to Excel
Summary: Formatting of Excel date values < 1.0 show different date to Excel
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.5-dev
Hardware: PC Windows XP
: P2 minor (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Blocks: 60165
  Show dependency tree
Reported: 2008-12-17 04:04 UTC by Steven Butler
Modified: 2016-10-11 14:32 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Steven Butler 2008-12-17 04:04:23 UTC
In Excel 2003, when a TIME(h,m,s) value is formatted as a date, or includes a date component.  For example, when TIME(12,0,0) is formatted with the format string "yyyy-mm-dd hh:mm:ss", the date is shown as
1900-01-00 12:00:00 in Excel.

This is obviously not a correct date but it is what Excel does with the value.

POI formats the value as
1899-12-31 12:00:00

which is a valid date, but not the same as the value produced by Excel.
Comment 1 Nikolay Durygin 2014-11-10 11:15:28 UTC
The same issue for Excel 2010. Moreover if you write this date back to Excel - it won't set correct date (because Excel doesn't handle dates before 1900).

Thus when you just read a value and write it back without changing - you get broken data. Can it be considered as a bug? Shouldn't POI handle such cases?

My comment isn't strictly about the initial issue but is very close. Decided to put it here.