TimeZone getID() in Java

getID(): This method is available in java.util.TimeZone class of Java.

Syntax:

String java.util.TimeZone.getID()

This method gets the ID of this time zone.

Parameters: NA

Returns: the ID of this time zone.

Exceptions: NA

Approach

Java

import java.util.SimpleTimeZone;
import java.util.TimeZone;

public class TimeZonegetID {
    public static void main(String[] args) {

        TimeZone timeZone = new SimpleTimeZone(100, "US");

        System.out.println(timeZone.getID());
    }
}

Output:

US


No comments:

Post a Comment