This article will cover the following Temporal
classes— Instant
, LocalDate
, LocalDateTime
, ZonedDateTime
, OffsetDateTime
, LocalTime
, and OffsetTime
.
You may also like: Java Date and Time
Date – Instant
In order to convert from Date
to Instant
, the solution can rely on the Date.toInstant()
method. The reverse can be accomplished via the Date.from(Instant instant)
method: