to ZonedDateTime - Java java.time

Java examples for java.time:ZonedDateTime

Description

to ZonedDateTime

Demo Code


//package com.java2s;

import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;

public class Main {
    public static ZonedDateTime toZonedDateTime(Date utilDate) {
        if (utilDate == null) {
            return null;
        }/*from   ww w. ja v a 2 s  .  c o  m*/
        final ZoneId systemDefault = ZoneId.systemDefault();
        return ZonedDateTime.ofInstant(utilDate.toInstant(), systemDefault);
    }
}

Related Tutorials