List of utility methods to do Date Format ISO
String | NowFormatISO() Now Format ISO return new SimpleDateFormat(FORMAT_ISO).format(Now()); |
String | nowISO8601() Get the current time formatted to ISO8601 final TimeZone tz = TimeZone.getTimeZone("UTC"); final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); df.setTimeZone(tz); return df.format(new Date()); |
String | parseISODateFormat(String dateStr) parse ISO Date Format if (dateStr == null) return null; String val = dateStr; try { if (dateStr.indexOf('T') == 10 && dateStr.endsWith("Z")) { Date date = CREATION_DATE_FORMAT.parse(dateStr); val = GUNVOR_TOOLS_DATE_FORMAT.format(date); } else if (dateStr.indexOf('T') == 10) { ... |
Date | parseIsoDateTime(final String isoDateString, final String dateFormat) parse Iso Date Time final DateFormat df = new SimpleDateFormat(dateFormat); df.setTimeZone(TimeZone.getDefault()); Date date; try { date = df.parse(isoDateString); } catch (final ParseException ex) { return null; return date; |
String | timeToIso8601(long time, boolean includeTime) time To Iso if (time == 0) return null; Date date = new Date(time); String formatString = "yyyy-MM-dd'T'HH:mm:ssZ"; if (!includeTime) formatString = "yyyy-MM-dd"; return new SimpleDateFormat(formatString).format(date); |
String | toBasicISO8601DateTime(Date value) to Basic ISO Date Time synchronized (basicISO8601DateTimeFormatter) { return basicISO8601DateTimeFormatter.format(value); |
String | toDateIso(Date date) Convert date into a string whose format is yyyy-MM-dd String val = ""; try { val = sdfDateIso.get().format(date); } catch (Exception e) { val = sdfDateIso.get().format(new Date(0)); return val; |
String | toISO2616DateFormat(Date date) to ISO Date Format SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); return dateFormat.format(date); |
String | toIso8601(@Nullable Calendar calendar) Converts a Calendar -object to a ISO-8601 string. if (calendar == null) { return null; return javax.xml.bind.DatatypeConverter.printDateTime(calendar); |
String | toIso8601(Date date) Formats a date into an ISO 8601 string. if (date == null) return null; DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", Locale.US); fmt.setTimeZone(TimeZone.getTimeZone("UTC")); return fmt.format(date); |