/** * Obtains an instance of {@code ZonedDateTime} from a text string such as * {@code 2007-12-23T10:15:30+01:00[Europe/Paris]}. * <p> * The string must represent a valid date-time and is parsed using * {@link org.threeten.bp.format.DateTimeFormatter#ISO_ZONED_DATE_TIME}. * * @param text the text to parse such as "2007-12-23T10:15:30+01:00[Europe/Paris]", not null * @return the parsed zoned date-time, not null * @throws DateTimeParseException if the text cannot be parsed */ public static ZonedDateTime parse(CharSequence text) { return parse(text, DateTimeFormatter.ISO_ZONED_DATE_TIME); }
/** * Obtains an instance of {@code ZonedDateTime} from a text string such as * {@code 2007-12-03T10:15:30+01:00[Europe/Paris]}. * <p> * The string must represent a valid date-time and is parsed using * {@link org.threeten.bp.format.DateTimeFormatter#ISO_ZONED_DATE_TIME}. * * @param text the text to parse such as "2007-12-03T10:15:30+01:00[Europe/Paris]", not null * @return the parsed zoned date-time, not null * @throws DateTimeParseException if the text cannot be parsed */ public static ZonedDateTime parse(CharSequence text) { return parse(text, DateTimeFormatter.ISO_ZONED_DATE_TIME); }
@Override protected ZonedDateTime deserialize(String key, DeserializationContext ctxt) throws IOException { // not serializing timezone data yet try { return ZonedDateTime.parse(key, DateTimeFormatter.ISO_OFFSET_DATE_TIME); } catch (DateTimeException e) { return _rethrowDateTimeException(ctxt, ZonedDateTime.class, e, key); } } }