Click here to watch on Youtube:
https://www.youtube.com/watch?v=rQRv-WuLLRY&list=UUhwKlOVR041tngjerWxVccw
TimeZoneDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/TimeZoneDemo_getDisplayName_DL_Style_locale.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/TimeZoneDemo_getDisplayName_DL_Style_locale
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/5bada39e8532ab4b75aaa28b80cdcee21bf19ab7/BasicJava_2018/TimeZoneDemo_getDisplayName_DL_Style_locale/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Spring Tutorial
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
Cooking Tutorial
https://www.youtube.com/watch?v=rQRv-WuLLRY&list=UUhwKlOVR041tngjerWxVccw
TimeZoneDemo.java
import java.util.Locale;
import java.util.TimeZone;
public class TimeZoneDemo
{
public static void main(String[] args)
{
TimeZone timezonedefault = TimeZone.getDefault();
/*
* Parameters:
*
* daylight - true specifying a Daylight Saving Time name, or
* false specifying a Standard Time
*
* namestyle - either LONG or SHORTReturns:the human-readable
* name of this time zone in the default locale.
*
* locale - the locale in which to supply the display name.
*
* Returns:
*
* the human-readable name of this time zone in the given
* locale.
*/
String displayName = timezonedefault.getDisplayName(true, TimeZone.LONG,
new Locale("EN", "US"));
System.out.println("displayName = " + displayName);
displayName = timezonedefault.getDisplayName(true, TimeZone.SHORT,
new Locale("EN", "US"));
System.out.println("displayName = " + displayName);
}
}
import java.util.TimeZone;
public class TimeZoneDemo
{
public static void main(String[] args)
{
TimeZone timezonedefault = TimeZone.getDefault();
/*
* Parameters:
*
* daylight - true specifying a Daylight Saving Time name, or
* false specifying a Standard Time
*
* namestyle - either LONG or SHORTReturns:the human-readable
* name of this time zone in the default locale.
*
* locale - the locale in which to supply the display name.
*
* Returns:
*
* the human-readable name of this time zone in the given
* locale.
*/
String displayName = timezonedefault.getDisplayName(true, TimeZone.LONG,
new Locale("EN", "US"));
System.out.println("displayName = " + displayName);
displayName = timezonedefault.getDisplayName(true, TimeZone.SHORT,
new Locale("EN", "US"));
System.out.println("displayName = " + displayName);
}
}
Output
displayName = India Daylight Time
displayName = IDT
displayName = IDT
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/TimeZoneDemo_getDisplayName_DL_Style_locale.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/TimeZoneDemo_getDisplayName_DL_Style_locale
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/5bada39e8532ab4b75aaa28b80cdcee21bf19ab7/BasicJava_2018/TimeZoneDemo_getDisplayName_DL_Style_locale/?at=master
See also:
No comments:
Post a Comment