Bug 56478 - TEXT function date format does not format number when the format contains non-standard characters
Summary: TEXT function date format does not format number when the format contains non...
Status: RESOLVED WONTFIX
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.10-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-01 13:27 UTC by James Clark
Modified: 2019-03-10 16:36 UTC (History)
1 user (show)



Attachments
An example Java program and spreadsheet to demonstrate the issue (1.99 KB, application/octet-stream)
2014-05-01 13:27 UTC, James Clark
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Clark 2014-05-01 13:27:21 UTC
Created attachment 31580 [details]
An example Java program and spreadsheet to demonstrate the issue

When using the TEXT function and combining it with the NOW function as its value, the POI FormulaEvaluator works fine when dealing with a standard format e.g:

=TEXT(NOW();"yyyy-MM-ddhh-mm-ss")

Excel output = 2014-05-0114-25-35
POI output = 2014-05-0114-25-35

When the format contains a less typical value however, the string value returned is  the unformatted output of NOW(). For example, the case we have (and demonstrated in the attached program) is when the format contains a 'T':

=TEXT(NOW();"yyyy-MM-ddThh-mm-ss")

Excel output = 2014-05-01T14-24-17
POI output = 41760.60074957176

Thanks,
James
Comment 1 Nick Burch 2015-11-04 18:21:21 UTC
We've had a few fixes in this sort of area since you reported this, any chance you could retest with 3.13 final (or even better a nightly build / svn checkout build), and let us know if the problem still remains?
Comment 2 Dominik Stadler 2019-03-10 16:36:32 UTC
There was no response for a very long time and I could not reproduce this locally, the test-code actually results in #VALUE and LibreOffice formats the date in a very strange way, unfortunately I do not have MSOffice available right now.

If this is still a problem with the latest version of Apache POI (currently 4.0.1) then please reopen this bug-report with some more information.