Bug 47071 - Date format Localization
Summary: Date format Localization
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.5-dev
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2009-04-21 23:24 UTC by akira yokoi
Modified: 2016-02-14 08:24 UTC (History)
0 users

The format of A-1 and A-2 cells is Japanese Date format. (8.26 KB, application/octet-stream)
2009-04-22 03:35 UTC, akira yokoi

Note You need to log in before you can comment on or make changes to this bug.
Description akira yokoi 2009-04-21 23:24:09 UTC
This is with 3.5 beta 5.

in org.apache.poi.ss.usermodel.DateUtil.isADateFormat()

The following regular expression is used for the judgment whether CellStyle.getDataFormatString() is a Date format or not. 
 fs.matches("^[yYmMdDhHsS\\-/,. :]+[ampAMP/]*$") // line 239

However, For instance, the following marks are generally prepared as a built-in format in the Japanese version Excel, which are NOT recognized as Date format.  

I think that you should check it by the regular expression after removing the part enclosed with "" so that localized format can be recognized as Date format.

like this
    // And '"any"' into ''
    while( fs.contains("\"")){
        int beginIdx = fs.indexOf("\"");
        if( beginIdx == -1){
        int endIdx = fs.indexOf( "\"", beginIdx + 1);
        if( endIdx == -1){
        fs = fs.replaceFirst( fs.substring( beginIdx, endIdx + 1),"");
Comment 1 Nick Burch 2009-04-22 03:04:44 UTC
Any chance you could upload a sample file with one of the problem formatting rules, and a failing unit test?
Comment 2 akira yokoi 2009-04-22 03:35:17 UTC
Created attachment 23527 [details]
The format of A-1 and A-2 cells is Japanese Date format.

The format of A-1 and A-2 cells is Japanese Date format.