Bug 59227 - Unable to get the cell correct value with Chinese date format
Summary: Unable to get the cell correct value with Chinese date format
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2016-03-24 01:16 UTC by ZhouTiefeng
Modified: 2017-02-08 08:36 UTC (History)
2 users (show)


Note You need to log in before you can comment on or make changes to this bug.
Description ZhouTiefeng 2016-03-24 01:16:38 UTC
The cell content is the Chinese date format,but DateUtil.isCelDateFormatted always think this content is a double not a date
Comment 1 Nick Burch 2016-03-24 09:39:51 UTC
Could you please attach a very small sample file that shows the problem, along with the code to reproduce it?

It'd also help if you could also let us know what cell.getCellStyle().getDataFormatString() reports for the cell too
Comment 2 Javen O'Neal 2016-03-24 17:26:07 UTC
By Chinese date format, do you mean YYYY-MM-DD or 2006年1月29日?

In addition, could you suggest a patch to get your date format working? See isCellDateFormatted and isADateFormat: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java?revision=1701688&view=markup#l483
Comment 3 Kalyan 2016-09-26 16:14:47 UTC
even I ran into similar issue. The cell is formatted as date and the value in the Cell is 二○○七年十二月六日

Format Index: 177
Format String: [DBNum1][$-804]yyyy"?"m"?"d"?";@
Is date format: false

org.apache.poi.ss.usermodel.DateUtil.isADateFormat() returns false.
Comment 4 Kalyan 2016-09-26 16:25:48 UTC
Here is the correct format string [DBNum1][$-804]yyyy"年"m"月"d"日";@
Comment 5 jzhao 2016-12-01 03:18:22 UTC

Any news about this issue?

Comment 6 jzhao 2017-02-08 08:07:53 UTC

I have add a pull request for this issue:

Anyone who can help review and merge about this?

Comment 7 Javen O'Neal 2017-02-08 08:36:40 UTC
Looks good to me. Committed in r1782119 and 1782120.

Thanks for the patch and unit test!

I changed our Java source encoding from ASCII to UTF-8. If this causes problems (such as using editors that assume a different encoding), we can replace the unicode characters with the escaped equivalents.

Will be included in 3.16 beta 3