diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java index b8091973e..6fb7f65be 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java @@ -55,6 +55,7 @@ public final class PackagePropertiesPart extends PackagePart implements private final static String[] DATE_FORMATS = new String[]{ DEFAULT_DATEFORMAT, "yyyy-MM-dd'T'HH:mm:ss.SS'Z'", + "yyyy-MM-dd" }; //Had to add this and TIME_ZONE_PAT to handle tz with colons. @@ -635,7 +636,7 @@ public final class PackagePropertiesPart extends PackagePart implements if (date == null) { return ""; } - + SimpleDateFormat df = new SimpleDateFormat(DEFAULT_DATEFORMAT, Locale.ROOT); df.setTimeZone(LocaleUtil.TIMEZONE_UTC); return df.format(date); diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java index 52ee4ffd8..b29d21fc0 100644 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java @@ -94,6 +94,9 @@ public final class TestPackageCoreProperties { props.setCreatedProperty("2007-05-12T06:00:00-0200"); assertEquals(dateToInsert, props.getCreatedProperty().getValue()); + props.setCreatedProperty("2015-07-27"); + assertEquals(msdf.parse("2015-07-27T00:00:00.000Z"), props.getCreatedProperty().getValue()); + props.setCreatedProperty("2007-05-12T10:00:00.123+0200"); assertEquals(msdf.parse("2007-05-12T08:00:00.123Z"), props.getCreatedProperty().getValue());