summaryrefslogtreecommitdiff
path: root/src/main
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 /src/main
parent2151d0b1dd7b2c5199d394c5ae399a36da7670ef (diff)
downloadegovutils-ae94463cce9b26ca26d7075d386b0724a2cb34a8.tar.gz
egovutils-ae94463cce9b26ca26d7075d386b0724a2cb34a8.tar.bz2
egovutils-ae94463cce9b26ca26d7075d386b0724a2cb34a8.zip
add timezone info to fix UTC problem
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/gv/util/MiscUtil.java9
1 files changed, 7 insertions, 2 deletions
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) {