Java examples for java.time:ZonedDateTime
Converts a java.util.Date to java.time.ZonedDateTime.
//package com.java2s; import java.time.*; import java.util.Date; public class Main { /**// w w w. j a v a 2 s. co m * Converts a java.util.Date to java.time.ZonedDateTime. * * @param date The Date input * @return A ZonedDateTime representing the time */ public static ZonedDateTime convertDate(Date date) { return date.toInstant().atZone(ZoneId.systemDefault()); } }