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

Stringiso8601(final Date date)
iso
final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
final String result = dateFormatter.format(date);
return result.substring(0, result.length() - 2) + ":" + result.substring(result.length() - 2);
Stringiso8601Date(Date d)
Return the ISO8601 string representation of a date.
if (d == null)
    return null;
SimpleDateFormat asGMTiso8601 = new SimpleDateFormat(PATTERN_ISO8601); 
asGMTiso8601.setTimeZone(TimeZone.getTimeZone("GMT"));
return asGMTiso8601.format(d);
StringisoDateFormat(Calendar calendar)
iso Date Format
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
df.setTimeZone(tz);
return df.format(calendar.getTime());
StringisoDateFormat(final Date date)
Formatea una fecha en YYYY-MM-DD
return getFormatter().format(date);
StringisoDateTimeUTC(final Date val)
Turn Date into "yyyyMMddTHHmmssZ"
synchronized (isoDateTimeUTCFormat) {
    return isoDateTimeUTCFormat.format(val);
StringisoFormat(Date date)
iso Format
return isoDateFormat.format(date);
StringisoTime(Date d)
iso Time
if (d == null)
    return null;
return isoDateFormat.format(d);
StringlongToISODate(long longDate)
long To ISO Date
Date date = new Date(longDate);
return dateToISODate(date);
StringmakeDateISO8601(Date date)
make Date ISO
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String result = df.format(date);
result = result.substring(0, result.length() - 2) + ":" + result.substring(result.length() - 2);
return result;
StringmillisecondsToISO8601(long date)
Converts the date and time provided in numbers of milliseconds since the epoch to a ISO8601 date and time representation (UTC to the millisecond).
return ISO8601_DATE_FORMAT.format(new Date(date));