Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
interface SomeDataClass { TemporalAccessor getSomeTime(); } //somewhere in the impl... public TemporalAccessor getSomeTime() { return OffsetDateTime.from(dateTimeFormatter.parse(someDateInstring)); }
有谁知道如何从这个TemporalAccessor界面获取时区数据?
TemporalAccessor
如果您需要ZoneOffsetor ZoneId,您可以从以下位置创建它TemporalAccessor:
ZoneOffset
ZoneId
TemporalAccessor acc = ZonedDateTime.now(); System.out.println(ZoneOffset.from(acc)); System.out.println(ZoneId.from(acc));