git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1767026 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_16_BETA1
@@ -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); |
@@ -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()); | |||