LegacyConverters { public static ZonedDateTime toZonedDateTime( Date date ) { return toZonedDateTime( date, ZoneId.systemDefault() ); }  static ZonedDateTime toZonedDateTime( Date date ); static ZonedDateTime toZonedDateTime( Date date, ZoneId zoneId ); static LocalDateTime toLocalDateTime( Date date ); static LocalDate toLocalDate( Date date ); static LocalTime toLocalTime( Date date ); static YearMonth toYearMonth( Date date ); static MonthDay toMonthDay( Date date ); static Date toDate( ZonedDateTime dateTime ); static Date toDate( Instant instant ); static Timestamp toTimestamp( ZonedDateTime dateTime ); static Timestamp toTimestamp( Instant instant );  }
@Test public void dateToZonedDateTimeTest() { long epochMillis = 31415926535L; String tz = "Africa/Nairobi"; ZoneId tzId = ZoneId.of( tz ); Date date = new Date( epochMillis ); ZonedDateTime zdt = toZonedDateTime( date, tzId ); assertEquals( date.getTime(), zdt.toInstant().toEpochMilli() ); }