Bug 44977 - date with am/pm isn't regarded as date formated data
Summary: date with am/pm isn't regarded as date formated data
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-12 10:53 UTC by Min Li
Modified: 2008-05-20 09:37 UTC (History)
0 users



Attachments
Fixes of the date formated data with am/pm (548 bytes, patch)
2008-05-12 10:53 UTC, Min Li
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Min Li 2008-05-12 10:53:59 UTC
Created attachment 21952 [details]
Fixes of the date formated data with am/pm

For any date cell with am/pm in the format isn't regarded as date formated data. For example: isADateFormat return false with the cell of '4/2/2007  12:00:00 AM'.
The simple fixes attached below:
Index: src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java
===================================================================
--- src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java	(revision 655573)
+++ src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java	(working copy)
@@ -226,7 +226,7 @@
     	
     	// Otherwise, check it's only made up, in any case, of:
     	//  y m d h s - / , . :
-    	if(fs.matches("^[yYmMdDhHsS\\-/,. :]+$")) {
+    	if(fs.matches("^[yYmMdDhHsSAP\\-/,. :]+$")) {
     		return true;
     	}
Comment 1 Nick Burch 2008-05-20 09:37:28 UTC
Something similar applied to trunk, hopefully it'll now work fine for you