Java Utililty Methods Date Format ISO

List of utility methods to do Date Format ISO

Description

The list of methods to do Date Format ISO are organized into topic(s).

Method

StringformatISODateTime(Date date)
Format Date into ISO 8601 full datetime string.
if (date == null)
    return null;
synchronized (ISO_DATE_FORMAT) {
    return ISO_DATE_FORMAT.format(date);
StringformatOneDecimal(int iNumber, int iDivisor)
format One Decimal
if (iDivisor == 0) {
    return "??";
return formatOneDecimal(iNumber / (double) iDivisor);
StringformattedIso8601DateString(Calendar pCal)
formatted Iso Date String
Date date = pCal.getTime();
String result = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(date);
return result + "Z";
StringformatTimestampIso8601(long millis, TimeZone zone)
Returns a string representation of the specified timestamp value in the ISO 8601 (RFC 3339) format (e.g.
SimpleDateFormat f = new SimpleDateFormat(TIMESTAMP_FORMAT_ISO8601, Locale.US);
f.setTimeZone(zone != null ? zone : TimeZone.getDefault());
return f.format(new Date(millis));
StringformatToIso8601(Date d)
Formats a Date into a String in ISO8601 format
synchronized (MONITOR) {
    return ISO8601.format(d);
StringformatToISO8601(Date date)
Formata a data para o formato ISO8601 usado pelo elastic search
String formatted = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(date);
return formatted.substring(0, 22) + ":" + formatted.substring(22);
StringformatWikiISO8601(Date d)
format Wiki ISO
return ISO8601_WIKI_FORMAT.format(d);
CalendarfromIso8601(@Nullable String date)
Converts a ISO-8601 string to a Calendar -object.
if (date == null) {
    return null;
return javax.xml.bind.DatatypeConverter.parseDateTime(date);
DatefromIso8601(String iso)
Converts an ISO 8601 string to a date.
if (iso == null)
    return null;
Calendar c1 = DatatypeConverter.parseDateTime(iso);
GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
c.setTimeInMillis(c1.getTimeInMillis());
return new Date(c.getTimeInMillis());
Stringget_ISO_8601()
geIS_
String result = _ISO_8601.get().format(new Date());
result = result.replace("GMT", "");
return result;