summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2018-02-14 20:10:49 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2018-02-14 20:10:49 +0100
commitae94463cce9b26ca26d7075d386b0724a2cb34a8 (patch)
tree58239e1df9159e1bdf18cf78edf179eceece1c72
parent2151d0b1dd7b2c5199d394c5ae399a36da7670ef (diff)
downloadegovutils-ae94463cce9b26ca26d7075d386b0724a2cb34a8.tar.gz
egovutils-ae94463cce9b26ca26d7075d386b0724a2cb34a8.tar.bz2
egovutils-ae94463cce9b26ca26d7075d386b0724a2cb34a8.zip
add timezone info to fix UTC problem
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/at/gv/util/MiscUtil.java9
2 files changed, 8 insertions, 3 deletions
diff --git a/pom.xml b/pom.xml
index 43394a5..e2d8f34 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>at.gv.util</groupId>
<artifactId>egovutils</artifactId>
- <version>2.0.2</version>
+ <version>2.0.3</version>
<name>zuseutil</name>
<url>http://maven.apache.org</url>
<properties>
diff --git a/src/main/java/at/gv/util/MiscUtil.java b/src/main/java/at/gv/util/MiscUtil.java
index 97da3dc..7ad055e 100644
--- a/src/main/java/at/gv/util/MiscUtil.java
+++ b/src/main/java/at/gv/util/MiscUtil.java
@@ -32,6 +32,7 @@ import java.util.Formatter;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.Properties;
+import java.util.TimeZone;
import javax.servlet.http.HttpServletRequest;
import javax.xml.datatype.DatatypeConfigurationException;
@@ -354,13 +355,17 @@ public class MiscUtil {
}
public static Date parseDate(String dateString) {
- return parseDate(dateString, "dd.MM.yyyy");
+ return parseDate(dateString, "dd.MM.yyyy", TimeZone.getTimeZone("UTC"));
}
- public static Date parseDate(String dateString, String pattern) {
+ public static Date parseDate(String dateString, String pattern, TimeZone zone) {
MiscUtil.assertNotNull(dateString, "dateString");
MiscUtil.assertNotNull(pattern, "pattern");
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+
+ if (zone != null)
+ sdf.setTimeZone(zone);
+
try {
return sdf.parse(dateString);
} catch (ParseException e) {