Bug 44977

Summary: date with am/pm isn't regarded as date formated data
Product: POI Reporter: Min Li <limin9>
Component: HSSFAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: Fixes of the date formated data with am/pm

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