diff options
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | src/main/java/at/gv/util/MiscUtil.java | 9 |
2 files changed, 8 insertions, 3 deletions
@@ -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) { |