Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static void main(String[] argv) {

        Date dateFromInstant = Date.from(Instant.now());
        System.out.println(dateFromInstant);
        java.util.TimeZone timeZone = java.util.TimeZone.getTimeZone(ZoneId.of("America/Los_Angeles"));
        System.out.println(timeZone);

        GregorianCalendar gregorianCalendar = GregorianCalendar.from(ZonedDateTime.now());
    }
}