java.util.TimeZone.getDisplayName() Method



The getDisplayName(boolean daylight,int style,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 String getDisplayName(boolean daylight,int style,Locale locale)


  • daylight -- if true, return the daylight savings name.

  • style -- This is either LONG or SHORT.

  • 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.


  • IllegalArgumentException -- This exception is thrown if the style is invalid.


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("US");
   // get display name for specific locale
   String disname=timezone.getDisplayName(true,1,new Locale("EN","US"));       
   // 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 :Greenwich Mean Time