VOOZH about

URL: https://www.geeksforgeeks.org/java/zoneoffset-getdisplayname-method-in-java-with-examples/

⇱ ZoneOffset getDisplayName() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ZoneOffset getDisplayName() method in Java with Examples

Last Updated : 13 Dec, 2018
The getDisplayName() method of the ZoneOffset class is used to get the textual representation of the zone suitable for presentation to the user such as 'British Time' or '+02:00'.If no textual mapping is found then the full ID is returned. Syntax:
public String getDisplayName(TextStyle style, Locale locale)
Parameters: This method accepts two parameters style and locale where style represents the length of the text required and locale represents the locale to use. Return value: This method returns the text value of the zone. Below programs illustrate the getDisplayName() method: Program 1:
Output:
Display Name: +05:30
Program 2:
Output:
Display Name: +05:30
Reference: Oracle Doc
Comment