Java Utililty Methods Date ISO Parse

List of utility methods to do Date ISO Parse

Description

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

Method

DateparseISO8601Date(String date)
Parses an ISO 8601 date and time value.
final String errorMessage = "Invalid ISO 8601 date format: ";
date = formatDateToParse(date, errorMessage);
DateFormat dateFormat = new SimpleDateFormat(ISO_8601_DATE_PATTERN + "Z");
try {
    return dateFormat.parse(date);
} catch (ParseException ex) {
    throw new IllegalArgumentException(errorMessage + date);
CalendarparseISO8601Date(String dateStr)

Parses a date that's in ISO8601 format.

String format;
if (ISO8601_DATE_BASIC_REGEX.matcher(dateStr).matches()) {
    format = "yyyyMMdd";
} else if (ISO8601_DATE_EXTENDED_REGEX.matcher(dateStr).matches()) {
    format = "yyyy-MM-dd";
} else if (ISO8601_TIME_BASIC_REGEX.matcher(dateStr).matches()) {
    format = "yyyyMMdd'T'HHmmssZ";
} else if (ISO8601_TIME_EXTENDED_REGEX.matcher(dateStr).matches()) {
...
DateparseIso8601Date(String datestr)
Parse a string as a date using the ISO8601_DATE format which is yyyy-MM-dd
return new SimpleDateFormat(ISO8601_DATE_PATTERN).parse(datestr);
DateparseIso8601Date(String dateString)
parse Iso Date
ParseException exception = null;
synchronized (iso8601DateParser) {
    try {
        return iso8601DateParser.parse(dateString);
    } catch (ParseException e) {
        exception = e;
synchronized (iso8601DateParser_Walrus) {
    try {
        return iso8601DateParser_Walrus.parse(dateString);
    } catch (ParseException e) {
throw exception;
DateparseISO8601Date(String dateString)
Parses a string representing a date using the ISO8601 pattern.
return parseDate(dateString, new String[] { ISO8601_DATE_PATTERN });
DateparseISO8601Date(String dateString)
Parses the ISO8601 date string.
if (!dateString.endsWith("Z")) {
    dateString += "Z";
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_PATTERN);
dateString = dateString.replaceAll("(\\.[0-9]{3})[0-9]*(Z)", "$1$2");
if (dateString.endsWith("Z")) {
    dateString = dateString.substring(0, dateString.length() - 1) + "GMT-00:00";
} else {
...
DateparseISO8601Date(String dateString)
parse ISO Date
try {
    return new SimpleDateFormat(ISO8601_DATE_FORMAT).parse(dateString);
} catch (ParseException e1) {
    try {
        return new SimpleDateFormat(ISO8601_DATE_FORMAT_WITHOUT_TZ).parse(dateString);
    } catch (ParseException e2) {
        return null;
DateparseIso8601Date(String dateString)
parse Iso Date
try {
    return getIso8601DateFormat().parse(dateString);
} catch (ParseException e) {
return getAlternativeIso8601DateFormat().parse(dateString);
DateparseISO8601Date(String encoded, Date fallback)
parse ISO Date
if (encoded == null)
    return fallback;
int length = encoded.length();
if (length == 4)
    encoded += "-01-01T00:00:00-0000";
else if (length == 7)
    encoded += "-01T00:00:00-0000";
else if (length == 10)
...
DateparseISO8601Date(String s)
parse ISO Date
if (s == null || s.isEmpty()) {
    return null;
try {
    Date date = null;
    if (s.charAt(s.length() - 1) == 'Z') {
        String format = (s.length() == ISO8601DATE_FORMAT_VALUE_LENGTH) ? ISO8601DATE_FORMAT
                : ISO8601DATE_WITH_MILLS_FORMAT;
...