java.util.TimeZone.getDisplayName() Method


The getDisplayName(Locale locale) method is used to get a name of this time zone suitable for presentation to the user in the specified locale.


Following is the declaration for java.util.TimeZone.getDisplayName() method.

public final String getDisplayName(Locale locale)


locale − This is the locale in which to supply the display name.

Return Value

The method call returns the human-readable name of this time zone in the given locale.It can also return the default locale if the given locale is not recognized.




The following example shows the usage of java.util.TimeZone.getDisplayName()

package com.tutorialspoint;

import java.util.*;

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

      // create default time zone object
      TimeZone timezone = TimeZone.getTimeZone("Europe/Paris");

      // create locale
      Locale locale = new Locale("CHINESE", "CHINA");

      // get display name for specific locale
      String disname = timezone.getDisplayName(locale);       

      // checking display name         
      System.out.println("Display name is :" + disname);

Let us compile and run the above program, this will produce the following result.

Display name is :Central European Time
Kickstart Your Career

Get certified by completing the course

Get Started