December 7, 2023

Java 8 – Convert Date to LocalDate and LocalDateTime

Few examples to convert classic Date to Java Time dates and vice versa: Convert java.util.Date to java.time.LocalDate, Convert java.util.Date to java.time.LocalDateTime, Convert java.util.Date to java.time.ZonedDateTime. The java.util.Date has no concept of time zone, and only represents the number of seconds passed since the Unix epoch time. The new Java 8 java.time.Instant is the equivalent class to the classic java.util.Date. The idea of the date conversion is to convert to an instant with a time zone.

Java 8 – Convert Date to LocalDate and LocalDateTime Read More