/** * Same as {@link #parseXSDateTime(String, TimeZone, CalendarFieldsToDateConverter)} but for ISO 8601 format. */ public static Date parseISO8601DateTime( String dateTimeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) throws DateParseException { Matcher m = PATTERN_ISO8601_EXTENDED_DATE_TIME.matcher(dateTimeStr); if (!m.matches()) { m = PATTERN_ISO8601_BASIC_DATE_TIME.matcher(dateTimeStr); if (!m.matches()) { throw new DateParseException("The value (" + dateTimeStr + ") didn't match the expected pattern: " + PATTERN_ISO8601_EXTENDED_DATE_TIME + " or " + PATTERN_ISO8601_BASIC_DATE_TIME); } } return parseDateTime_parseMatcher( m, defaultTZ, false, calToDateConverter); }
/** * Parses an W3C XML Schema date-time string (not date or time). * Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid. * * @param dateTimeStr the string to parse. * @param defaultTZ used if the dateTime doesn't specify the * time zone offset explicitly. Can't be {@code null}. * * @throws DateParseException if the dateTime is malformed. */ public static Date parseXSDateTime( String dateTimeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) throws DateParseException { Matcher m = PATTERN_XS_DATE_TIME.matcher(dateTimeStr); if (!m.matches()) { throw new DateParseException( "The value didn't match the expected pattern: " + PATTERN_XS_DATE_TIME); } return parseDateTime_parseMatcher( m, defaultTZ, true, calToDateConverter); }
/** * Same as {@link #parseXSDateTime(String, TimeZone, CalendarFieldsToDateConverter)} but for ISO 8601 format. */ public static Date parseISO8601DateTime( String dateTimeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) throws DateParseException { Matcher m = PATTERN_ISO8601_EXTENDED_DATE_TIME.matcher(dateTimeStr); if (!m.matches()) { m = PATTERN_ISO8601_BASIC_DATE_TIME.matcher(dateTimeStr); if (!m.matches()) { throw new DateParseException("The value (" + dateTimeStr + ") didn't match the expected pattern: " + PATTERN_ISO8601_EXTENDED_DATE_TIME + " or " + PATTERN_ISO8601_BASIC_DATE_TIME); } } return parseDateTime_parseMatcher( m, defaultTZ, false, calToDateConverter); }
/** * Same as {@link #parseXSDateTime(String, TimeZone, CalendarFieldsToDateConverter)} but for ISO 8601 format. */ public static Date parseISO8601DateTime( String dateTimeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) throws DateParseException { Matcher m = PATTERN_ISO8601_EXTENDED_DATE_TIME.matcher(dateTimeStr); if (!m.matches()) { m = PATTERN_ISO8601_BASIC_DATE_TIME.matcher(dateTimeStr); if (!m.matches()) { throw new DateParseException("The value (" + dateTimeStr + ") didn't match the expected pattern: " + PATTERN_ISO8601_EXTENDED_DATE_TIME + " or " + PATTERN_ISO8601_BASIC_DATE_TIME); } } return parseDateTime_parseMatcher( m, defaultTZ, false, calToDateConverter); }
/** * Parses an W3C XML Schema date-time string (not date or time). * Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid. * * @param dateTimeStr the string to parse. * @param defaultTZ used if the dateTime doesn't specify the * time zone offset explicitly. Can't be {@code null}. * * @throws DateParseException if the dateTime is malformed. */ public static Date parseXSDateTime( String dateTimeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) throws DateParseException { Matcher m = PATTERN_XS_DATE_TIME.matcher(dateTimeStr); if (!m.matches()) { throw new DateParseException( "The value didn't match the expected pattern: " + PATTERN_XS_DATE_TIME); } return parseDateTime_parseMatcher( m, defaultTZ, true, calToDateConverter); }
/** * Parses an W3C XML Schema date-time string (not date or time). * Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid. * * @param dateTimeStr the string to parse. * @param defaultTZ used if the dateTime doesn't specify the * time zone offset explicitly. Can't be {@code null}. * * @throws DateParseException if the dateTime is malformed. */ public static Date parseXSDateTime( String dateTimeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) throws DateParseException { Matcher m = PATTERN_XS_DATE_TIME.matcher(dateTimeStr); if (!m.matches()) { throw new DateParseException( "The value didn't match the expected pattern: " + PATTERN_XS_DATE_TIME); } return parseDateTime_parseMatcher( m, defaultTZ, true, calToDateConverter); }