List of utility methods to do Date Format ISO
String | formatISO8601() format ISO return formatISO8601(new Date()); |
String | formatISO8601(Date date) format ISO if (date == null) { return null; Calendar cal = GregorianCalendar.getInstance(); cal.setTime(date); cal.setTimeZone(TimeZone.getTimeZone("UTC")); return DatatypeConverter.printDateTime(cal); |
String | formatIso8601(Date date) Format a date to in ISO 8601 format (as used by GIT) adjusted to UTC timezone. SimpleDateFormat formatter = createIso8601Format();
formatter.setTimeZone(UTC);
return formatter.format(date);
|
String | formatIso8601(Date date) format Iso if (date == null) return ""; String str = format(date, getIso8601DateFormat()); StringBuffer sb = new StringBuffer(); sb.append(str.substring(0, str.length() - 2)); sb.append(":"); sb.append(str.substring(str.length() - 2)); return sb.toString(); ... |
String | formatISO8601(Date date) format ISO return format(date, "yyyy-MM-dd'T'HH:mm:ss.SSS"); |
String | formatIso8601(Date date) format Iso SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ISO8601_TS_FORMAT); return simpleDateFormat.format(date); |
String | formatISO8601(Date date, TimeZone timeZone) Formats a DateTime to a ISO8601 string with a second fraction part of up to 3 digits. SimpleDateFormat df = null; if (timeZone != null) { df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSSZ"); df.setTimeZone(timeZone); String result = df.format(date); if (result.endsWith("0000")) return result.replaceAll("[+-]0000$", "Z"); return result.replaceAll("(\\d{2})(\\d{2})$", "$1:$2"); ... |
String | formatISO8601(final Date date) format ISO if (date == null) return ""; SimpleDateFormat dateFormat = new SimpleDateFormat(ISO8601_DATE_FORMAT_PATTERN); return dateFormat.format(date); |
String | formatISO8601(final Date date) Convert a Date to a ISO8601 string. Calendar cal = Calendar.getInstance(); cal.setTime(Preconditions.checkNotNull(date, "Date can not be null.")); return DatatypeConverter.printDateTime(cal); |
String | formatISO8601Date(Date d) Convert a Date to String in the ISO 8601 standard format. String result; outCal.setTime(d); if (outCal.get(Calendar.MILLISECOND) == 0) { result = outFmtSecond.format(d); } else { result = outFmtMillisec.format(d); int rl = result.length(); ... |