From: Nick Burch Date: Mon, 9 Jan 2012 18:21:54 +0000 (+0000) Subject: Patch from Steve Vysny from bug #52438 - Update CellDateFormatter to handle times... X-Git-Tag: REL_3_8_FINAL~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e0198826c38bfdcb578a4d9f9397b33a8779d41e;p=poi.git Patch from Steve Vysny from bug #52438 - Update CellDateFormatter to handle times without seconds git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1229281 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 5c420b3582..45adb130d6 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 52438 - Update CellDateFormatter to handle times without seconds 52389 - Support ?/? as well as #/# fractions, and tighten DataFormatter rules for fraction matching 52200 - Updated XWPF table example code 52378 - Support for WORKDAY and NETWORKDAYS functions diff --git a/src/java/org/apache/poi/ss/format/CellDateFormatter.java b/src/java/org/apache/poi/ss/format/CellDateFormatter.java index 5007305e21..33a9118b15 100644 --- a/src/java/org/apache/poi/ss/format/CellDateFormatter.java +++ b/src/java/org/apache/poi/ss/format/CellDateFormatter.java @@ -90,7 +90,11 @@ public class CellDateFormatter extends CellFormatter { case 'M': mStart = pos; mLen = part.length(); - return part.toUpperCase(); + // For 'm' after 'h', output minutes ('m') not month ('M') + if (hStart >= 0) + return part.toLowerCase(); + else + return part.toUpperCase(); case 'y': case 'Y': diff --git a/test-data/spreadsheet/DateFormatTests.xlsx b/test-data/spreadsheet/DateFormatTests.xlsx index a6099be4da..c6048309b8 100644 Binary files a/test-data/spreadsheet/DateFormatTests.xlsx and b/test-data/spreadsheet/DateFormatTests.xlsx differ