diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-02-15 19:40:04 -0600 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-02-15 20:04:29 -0600 |
commit | 628b7105ce4d9818aac69a082e515f9275fd46fd (patch) | |
tree | 3f1e073e6973efd06f950a70a12499976027eae4 /misc | |
parent | 4b6435c97dc1e05ee6a1e06190e3c431f9d1a8fe (diff) |
Batch work and client
Issue-ID: AAF-740
Change-Id: I16da4f2a87ec5d19590f0af642b91f9e2e02b246
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java | 25 |
1 files changed, 23 insertions, 2 deletions
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());
|