Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {

    public static void main(String[] args) {

        System.out.println(toZonedDateTime(new Date()));
    }

    public static ZonedDateTime toZonedDateTime(Date utilDate) {
        if (utilDate == null) {
            return null;
        }
        final ZoneId systemDefault = ZoneId.systemDefault();
        return ZonedDateTime.ofInstant(utilDate.toInstant(), systemDefault);
    }
}