From e568d9464c43705f157ac82e8d299adcc1369049 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 17 Apr 2014 17:25:50 +0200 Subject: add method to build default DateTime string --- .../java/at/gv/egovernment/moa/util/DateTimeUtils.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java index 1e219b784..dbc9faba6 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java @@ -106,6 +106,20 @@ public class DateTimeUtils { return f.format(cal.getTime()); } + /** + * Builds a dateTime value in UTC from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildDateTimeUTC(Date cal) { + + SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + f.setTimeZone(TimeZone.getTimeZone("UTC")); + + return f.format(cal); + + } + /** * Builds a dateTime value from a Calendar value. * @param cal the Calendar value -- cgit v1.2.3