List of utility methods to do Date ISO Parse
Date | parseIso8601Date(String strDate) parse Iso Date if (strDate == null) { return null; } else { return parseDate(strDate, ISO_DATE); |
Date | parseISO8601DateString(String dateString) parse ISO Date String SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); if (dateString.endsWith("Z")) { dateString = dateString.substring(0, dateString.length() - 1) + "GMT-00:00"; } else { dateString = dateString.replaceFirst("-(\\d\\d)(\\d\\d)", "-$1:$2"); int inset = 6; String s0 = dateString.substring(0, dateString.length() - inset); String s1 = dateString.substring(dateString.length() - inset, dateString.length()); ... |
Date | parseIso8601DateTimeOrDate(String datestr) Parse a string as a date using the either the ISO8601_DATETIME or ISO8601_DATE formats. try { return parseIso8601DateTime(datestr); } catch (ParseException px) { return parseIso8601Date(datestr); |
Date | parseISO8601String(String dateString) parse ISO String if (dateString == null) return (null); if (!dateString.endsWith("Z")) { int lastColon = dateString.lastIndexOf(":"); dateString = dateString.substring(0, lastColon) + dateString.substring(lastColon + 1); return (ISO8601.parse(dateString)); |
Date | parseISO8601TimeAndDateString(String dateString) parse ISO Time And Date String SimpleDateFormat sdf = new SimpleDateFormat(iso8601TimeAndDatePattern); try { return sdf.parse(dateString); } catch (ParseException e) { e.printStackTrace(); return null; |
Date | parseIso8601TimeStamp(String dateString) parse Iso Time Stamp SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ISO8601_TS_FORMAT); Date parsedDate = null; try { parsedDate = simpleDateFormat.parse(dateString); } catch (ParseException e) { throw new IllegalArgumentException( "Unable to parse " + dateString + " as ISO8601 datetime: " + e.getMessage(), e); return parsedDate; |
Date | parseIsoDate(@Nonnull String asString) parse Iso Date try { return new SimpleDateFormat(ISO_PATTERN).parse(asString); } catch (final ParseException e) { throw new IllegalArgumentException( "Could not parse: " + asString + ", it does not match pattern: " + ISO_PATTERN, e); |
Date | parseIsoDate(final String isoDateString) Format yyyy-mm-dd return parseIsoDate(isoDateString, TimeZone.getDefault());
|
Date | parseIsoDate(final String string) parse a iso date try { return getFormatter().parse(string); } catch (final ParseException e) { throw new IllegalArgumentException("`" + string + "' is not a valid ISO date", e); |
java.util.Date | parseISODate(String date) parse ISO Date if (isBlank(date)) return null; try { SimpleDateFormat sdf = new SimpleDateFormat(ISO_DATE_FORMAT); return sdf.parse(date); } catch (Exception e) { return null; ... |