Click here to watch on Youtube : 
https://www.youtube.com/watch?v=hwsPoqXxduo&list=UUhwKlOVR041tngjerWxVccw
ZoneIdDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ZoneIdDemo_getDisplayName.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ZoneIdDemo_getDisplayName
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/4bf907c20b634049430aea37cca3f8775ef090f9/BasicJava/ZoneIdDemo_getDisplayName/?at=master
See also:
All JavaEE Videos Playlist 
All JavaEE Videos 
All JAVA EE Links 
Servlets Tutorial 
All Design Patterns Links 
JDBC Tutorial 
Java Collection Framework Tutorial 
JAVA Tutorial 
Kids Tutorial 
https://www.youtube.com/watch?v=hwsPoqXxduo&list=UUhwKlOVR041tngjerWxVccw
ZoneIdDemo.java
import java.time.ZoneId;
import java.time.format.TextStyle;
import java.util.Locale;
public class ZoneIdDemo
{
public static void main(String[] args)
{
ZoneId zoneId = ZoneId.systemDefault();
/*
* Parameters:
*
* style - the length of the text required, not null
*
* locale - the locale to use, not null
*
* Returns:
*
* the text value of the zone, not null
*/
String displayName = zoneId.getDisplayName(TextStyle.FULL, Locale.US);
System.out.println("displayName FULL = " + displayName);
displayName = zoneId.getDisplayName(TextStyle.SHORT, Locale.US);
System.out.println("displayName SHORT = " + displayName);
displayName = zoneId.getDisplayName(TextStyle.NARROW, Locale.US);
System.out.println("displayName NARROW = " + displayName);
}
}
import java.time.format.TextStyle;
import java.util.Locale;
public class ZoneIdDemo
{
public static void main(String[] args)
{
ZoneId zoneId = ZoneId.systemDefault();
/*
* Parameters:
*
* style - the length of the text required, not null
*
* locale - the locale to use, not null
*
* Returns:
*
* the text value of the zone, not null
*/
String displayName = zoneId.getDisplayName(TextStyle.FULL, Locale.US);
System.out.println("displayName FULL = " + displayName);
displayName = zoneId.getDisplayName(TextStyle.SHORT, Locale.US);
System.out.println("displayName SHORT = " + displayName);
displayName = zoneId.getDisplayName(TextStyle.NARROW, Locale.US);
System.out.println("displayName NARROW = " + displayName);
}
}
Output
displayName FULL = India Time
displayName SHORT = IT
displayName NARROW = Asia/Calcutta
displayName SHORT = IT
displayName NARROW = Asia/Calcutta
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ZoneIdDemo_getDisplayName.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ZoneIdDemo_getDisplayName
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/4bf907c20b634049430aea37cca3f8775ef090f9/BasicJava/ZoneIdDemo_getDisplayName/?at=master
See also:
 


 
No comments:
Post a Comment