diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/gv/util/MiscUtil.java | 9 |
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) { |