TimeZone getDisplayName() in Java

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

Syntax:

String java.util.TimeZone.getDisplayName()

This method returns a long standard time name of this TimeZone suitable for presentation to the user in the default locale.

Parameters: NA

Returns: the human-readable name of this time zone in the default locale.

Exceptions: NA

Approach

Java

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

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

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

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

Output:

GMT+00:00


No comments:

Post a Comment