diff options
Diffstat (limited to 'src/main/java/at/gv/util/MiscUtil.java')
-rw-r--r-- | src/main/java/at/gv/util/MiscUtil.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/at/gv/util/MiscUtil.java b/src/main/java/at/gv/util/MiscUtil.java index 7ad055e..c0095f8 100644 --- a/src/main/java/at/gv/util/MiscUtil.java +++ b/src/main/java/at/gv/util/MiscUtil.java @@ -276,11 +276,27 @@ public class MiscUtil { } } + /** + * Parse XML date in date object in UTC timezone + * + * @param xmlDate String based date with pattern "yyyy-MM-dd" + * @return + * @throws EgovUtilException + */ public static Date parseXMLDate(String xmlDate) throws EgovUtilException { + return parseXMLDate(xmlDate, TimeZone.getTimeZone("UTC")); + + } + + public static Date parseXMLDate(String xmlDate, TimeZone zone) throws EgovUtilException { if (xmlDate == null) { return null; } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + if (zone != null) + sdf.setTimeZone(zone); + try { return sdf.parse(xmlDate); } catch (ParseException e) { |