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

StringtoISO8601(Date date)
Formats the given date to a ISO-8601 date/time format, and UTC timezone.
if (date == null) {
    return null;
synchronized (ISO_8601_DATE_FORMAT) {
    return ISO_8601_DATE_FORMAT.format(date);
StringtoISO8601(Date date)
Converts a date to its ISO8601/javascript representation.
return new SimpleDateFormat(ISO8601).format(date);
StringtoISO8601(Date date)
Serializes a date in full ISO8601 date/time format.
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String result = format.format(date);
result = result.substring(0, result.length() - 2) + ":" + result.substring(result.length() - 2);
return result;
StringtoISO8601(Date date)
to ISO
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
TimeZone tz = TimeZone.getTimeZone("UTC");
df.setTimeZone(tz);
return df.format(date);
StringtoIso8601(Date dateObj)
to Iso
DF.setTimeZone(TimeZone.getTimeZone("UTC"));
return DF.format(dateObj).replaceAll("\\+0000$", "Z");
StringtoIso8601(Date dateTime)
Formats a Date as an ISO 8601 string in the UTC timezone.
return FORMAT.format(dateTime);
StringtoISO8601(Date pDate)
Convert a given date to an ISO-8601 compliant string representation for the default timezone
return toISO8601(pDate, TimeZone.getDefault());
StringtoISO8601FileSystemCompatible(Calendar calendar)
to ISO File System Compatible
SimpleDateFormat iso8601 = new SimpleDateFormat(ISO8601_FILESYSTEM);
iso8601.setTimeZone(calendar.getTimeZone());
String missingDots = iso8601.format(calendar.getTime()).replace("GMT", "");
return missingDots.substring(0, missingDots.length() - 2) + missingDots.substring(missingDots.length() - 2);
StringtoISODate(String format, String value)
Gets a ISO representation of a date within a string, when provided the format of the original string.
SimpleDateFormat sdf = new SimpleDateFormat(format);
try {
    Date date = sdf.parse(value);
    sdf.applyPattern(isoDateStringFormat);
    return sdf.format(date);
} catch (ParseException e) {
return null;
...
StringtoISODateRealTimeFormat(Date iDate)
to ISO Date Real Time Format
DateFormat df = new SimpleDateFormat(ISO_DATE_TIME_FORMAT);
return df.format(iDate);