Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Calendar;
import java.util.TimeZone;

public class Main {

    public static void main(String[] args) {
        Calendar calNewYork = Calendar.getInstance();

        calNewYork.setTimeZone(TimeZone.getTimeZone("America/New_York"));

        System.out.println("Time in New York: " + calNewYork.get(Calendar.HOUR_OF_DAY) + ":"
                + calNewYork.get(Calendar.MINUTE));

    }
}
//Time in New York: 11:51