Get display name for a timezone
String getDisplayName()
- Returns a name of this time zone suitable for presentation to the user in the default locale.
String getDisplayName(boolean daylight, int style)
- Returns a name of this time zone suitable for presentation to the user in the default locale.
String getDisplayName(boolean daylight, int style, Locale locale)
- Returns a name of this time zone suitable for presentation to the user in the specified locale.
String getDisplayName(Locale locale)
- Returns a name of this time zone suitable for presentation to the user in the specified locale.
import java.util.TimeZone;
public class Main {
public static void main(String[] args) {
TimeZone tz = TimeZone.getTimeZone("America/New_York");
System.out.println(tz.getDisplayName());
}
}
The output:
Eastern Standard Time
Home
Java Book
Essential Classes
Java Book
Essential Classes
TimeZone:
- TimeZone class
- Create TimeZone
- Get availablve timezone ids
- Get display name for a timezone
- Get daylight saving
- Get timezone id