ZoneId getDisplayName(TextStyle style, Locale locale)
gets the textual representation of the zone, such as 'British Time' or '+02:00'.
getDisplayName
has the following syntax.
public String getDisplayName(TextStyle style, Locale locale)
The following example shows how to use getDisplayName
.
import java.time.ZoneId; import java.time.format.TextStyle; import java.util.Locale; //from w w w .j a va2 s.c o m public class Main { public static void main(String[] args) { ZoneId z = ZoneId.systemDefault(); System.out.println(z.getDisplayName(TextStyle.FULL, Locale.CANADA)); } }
The code above generates the following result.