]> source.dussan.org Git - poi.git/commitdiff
Fix bug #44977 - Support for AM/PM in excel date formats
authorNick Burch <nick@apache.org>
Tue, 20 May 2008 16:37:15 +0000 (16:37 +0000)
committerNick Burch <nick@apache.org>
Tue, 20 May 2008 16:37:15 +0000 (16:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@658322 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java

index acf5cfeab71148643d17d31d4267b5e51159499b..ebb063f2743eed31cd025396bf95d564873bd780 100644 (file)
@@ -37,6 +37,7 @@
 
                <!-- Don't forget to update status.xml too! -->
         <release version="3.1-final" date="2008-06-??">
+           <action dev="POI-DEVELOPERS" type="fix">44977 - Support for AM/PM in excel date formats</action>
            <action dev="POI-DEVELOPERS" type="add">Support for specifying a policy to HSSF on missing / blank cells when fetching</action>
            <action dev="POI-DEVELOPERS" type="add">44937 - Partial support for extracting Escher images from HWPF files</action>
            <action dev="POI-DEVELOPERS" type="fix">44824 - Avoid an infinite loop when reading some HWPF pictures</action>
index 41b47b99698e405bc161bd409c6984579061e3b6..2167a42574e620f50499904f7ce847812d4cf501 100644 (file)
@@ -34,6 +34,7 @@
        <!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.1-final" date="2008-06-??">
+           <action dev="POI-DEVELOPERS" type="fix">44977 - Support for AM/PM in excel date formats</action>
            <action dev="POI-DEVELOPERS" type="add">Support for specifying a policy to HSSF on missing / blank cells when fetching</action>
            <action dev="POI-DEVELOPERS" type="add">44937 - Partial support for extracting Escher images from HWPF files</action>
            <action dev="POI-DEVELOPERS" type="fix">44824 - Avoid an infinite loop when reading some HWPF pictures</action>
index 0e3d1ee54c144b3f879d0169aeccf136189a4f7b..910d2737c2b1fbfffec36b2c90f73fb74484ebea 100644 (file)
@@ -226,7 +226,8 @@ public class HSSFDateUtil
        
        // Otherwise, check it's only made up, in any case, of:
        //  y m d h s - / , . :
-       if(fs.matches("^[yYmMdDhHsS\\-/,. :]+$")) {
+       // optionally followed by AM/PM
+       if(fs.matches("^[yYmMdDhHsS\\-/,. :]+[ampAMP]*$")) {
                return true;
        }
        
index 861f5ed7fae3c6384942238a2f3eea7f21eefeae..6540f8f091e71693a2c59e507b04d6a3651f3907 100644 (file)
@@ -266,6 +266,8 @@ public class TestHSSFDateUtil extends TestCase {
         formats = new String[] {
                 "yyyy-mm-dd hh:mm:ss", "yyyy/mm/dd HH:MM:SS", 
                 "mm/dd HH:MM", "yy/mmm/dd SS",
+                "mm/dd HH:MM AM", "mm/dd HH:MM am",
+                "mm/dd HH:MM PM", "mm/dd HH:MM pm" 
         };
         for(int i=0; i<formats.length; i++) {
             assertTrue( HSSFDateUtil.isADateFormat(formatId, formats[i]) );