Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneId;
import java.time.ZonedDateTime;

public class Main {
    public static void main(String[] args) {
        LocalDateTime ldt = LocalDateTime.of(2014, Month.JUNE, 21, 16, 30);

        ZoneId usCentral = ZoneId.of("America/Chicago");
        ZonedDateTime zdt = ZonedDateTime.of(ldt, usCentral);
        System.out.println("In US  Central Time Zone:" + zdt);

        ZoneId losAngeles = ZoneId.of("America/Los_Angeles");
        ZonedDateTime zdt2 = zdt.withZoneSameInstant(losAngeles);
        System.out.println("In  America/Los_Angeles Time Zone:" + zdt2);

    }
}