本文整理了Java中org.threeten.bp.Instant.parse()
方法的一些代码示例,展示了Instant.parse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instant.parse()
方法的具体详情如下:
包路径:org.threeten.bp.Instant
类名称:Instant
方法名:parse
[英]Obtains an instance of Instant from a text string such as 2007-12-23T10:15:30.000Z.
The string must represent a valid instant in UTC and is parsed using DateTimeFormatter#ISO_INSTANT.
[中]从文本字符串(如2007-12-23T10:15:30.000Z)获取Instant的实例。
字符串必须表示UTC中的有效瞬间,并使用DateTimeFormatter#ISO#instant进行解析。
代码示例来源:origin: googleapis/google-cloud-java
/**
* Creates a Timestamp instance from the given string. String is in the RFC 3339 format without
* the timezone offset (always ends in "Z").
*/
public static Timestamp parseTimestamp(String timestamp) {
Instant instant = Instant.parse(timestamp);
return ofTimeSecondsAndNanos(instant.getEpochSecond(), instant.getNano());
}
代码示例来源:origin: com.google.cloud/google-cloud-core
/**
* Creates a Timestamp instance from the given string. String is in the RFC 3339 format without
* the timezone offset (always ends in "Z").
*/
public static Timestamp parseTimestamp(String timestamp) {
Instant instant = Instant.parse(timestamp);
return ofTimeSecondsAndNanos(instant.getEpochSecond(), instant.getNano());
}
代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp
return LocalDateTime.ofInstant(Instant.parse(string), ZoneOffset.UTC).toLocalDate();
} else {
return LocalDate.parse(string, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
内容来源于网络,如有侵权,请联系作者删除!