SimpleTimeZone getDisplayName() in Java

getDisplayName(): This method is available in java.util.SimpleTimeZone 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;

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

        SimpleTimeZone simpleTimeZone =
new SimpleTimeZone(100, "India");

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

Output:

GMT+00:00


No comments:

Post a Comment