org.threeten.bp.ZonedDateTime.parse()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.threeten.bp.ZonedDateTime.parse()方法的一些代码示例,展示了ZonedDateTime.parse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonedDateTime.parse()方法的具体详情如下:
包路径:org.threeten.bp.ZonedDateTime
类名称:ZonedDateTime
方法名:parse

ZonedDateTime.parse介绍

[英]Obtains an instance of ZonedDateTime from a text string such as 2007-12-23T10:15:30+01:00[Europe/Paris].

The string must represent a valid date-time and is parsed using org.threeten.bp.format.DateTimeFormatter#ISO_ZONED_DATE_TIME.
[中]从文本字符串(例如2007-12-23T10:15:30+01:00[Europe/Paris])获取ZoneDateTime的实例。
字符串必须表示有效的日期和时间,并使用org解析。三十。英国石油公司。总体安排DateTimeFormatter#ISO_Zone_DATE_TIME。

代码示例

代码示例来源:origin: ThreeTen/threetenbp

/**
 * 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);
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * 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);
}

代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp

@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);
    }
  }
}

相关文章