Is there any way to convert ZoneId to ZoneOffset in java 8?

前端 未结 7 1219
礼貌的吻别
礼貌的吻别 2020-12-13 05:26

I have an epoch second and a zoneId,by method1.It can be convert to LocalDateTime with system default zoneId,but I don\'t find the way to convert epoch second to LocalDateTi

7条回答
  •  借酒劲吻你
    2020-12-13 06:12

    As the documentation says, "This is primarily intended for low-level conversions rather than general application usage."

    Going via Instant makes perfect sense to me - your epoch second is effectively a different representation of an Instant, so convert to an Instant and then convert that into a particular time zone.

提交回复
热议问题