From 628b7105ce4d9818aac69a082e515f9275fd46fd Mon Sep 17 00:00:00 2001 From: Instrumental Date: Fri, 15 Feb 2019 19:40:04 -0600 Subject: Batch work and client Issue-ID: AAF-740 Change-Id: I16da4f2a87ec5d19590f0af642b91f9e2e02b246 Signed-off-by: Instrumental --- .../java/org/onap/aaf/misc/env/util/Chrono.java | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'misc') diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java index 553d7ade..f5de5d7d 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java @@ -38,7 +38,7 @@ import javax.xml.datatype.XMLGregorianCalendar; public class Chrono { private static final long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH = 0x01b21dd213814000L; - public final static DateFormat dateFmt, dateOnlyFmt, niceDateFmt, utcFmt,iso8601Fmt; + public final static DateFormat dateFmt, dateOnlyFmt, niceDateFmt, utcFmt, niceUTCDateFmt, iso8601Fmt; // Give general access to XML DataType Factory, since it's pretty common public static final DatatypeFactory xmlDatatypeFactory; @@ -52,8 +52,10 @@ public class Chrono { niceDateFmt = new SimpleDateFormat("yyyy/MM/dd HH:mm zzz"); dateFmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); utcFmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); - iso8601Fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX"); utcFmt.setTimeZone(TimeZone.getTimeZone("UTC")); + niceUTCDateFmt = new SimpleDateFormat("yyyy/MM/dd HH:mm zzz"); + niceUTCDateFmt.setTimeZone(TimeZone.getTimeZone("UTC")); + iso8601Fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX"); } @@ -120,6 +122,25 @@ public class Chrono { if (xgc==null)return ""; return utcFmt.format(xgc.toGregorianCalendar().getTime()); } + + public static String niceUTCStamp() { + return niceUTCDateFmt.format(new Date()); + } + + public static String niceUTCStamp(Date date) { + if (date==null)return ""; + return niceUTCDateFmt.format(date); + } + + public static String niceUTCStamp(GregorianCalendar gc) { + if (gc==null)return ""; + return niceUTCDateFmt.format(gc.getTime()); + } + + public static String niceUTCStamp(XMLGregorianCalendar xgc) { + if (xgc==null)return ""; + return niceUTCDateFmt.format(xgc.toGregorianCalendar().getTime()); + } public static String dateStamp() { return dateFmt.format(new Date()); -- cgit 1.2.3-korg