Wednesday 2 January 2019

How to use getID() and getDSTSavings() methods of java.util.TimeZone class


Click here to watch on Youtube:
https://www.youtube.com/watch?v=BTm3L0jLrCM&list=UUhwKlOVR041tngjerWxVccw

TimeZoneDemo.java

import java.util.TimeZone;

public class TimeZoneDemo
{
    public static void main(String[] args)
    {
        TimeZone timezone = TimeZone.getTimeZone("Europe/Paris");
       
       
        /*
         * Returns:the ID of this time zone.
         */

        System.out.println("ID value is = " + timezone.getID());

        /*
         * Returns:
         *
         * the amount of saving time in milliseconds
         */

        System.out.println("DST saving is = " + timezone.getDSTSavings());
    }
}

Output

ID value is = Europe/Paris
DST saving is = 3600000

Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/TimeZoneDemo_getDSTSavings.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/TimeZoneDemo_getDSTSavings

Bitbucket Link:
https://bitbucket.org/ramram43210/java_spring_2019/src/80d90bcf5505788c0f100e330fb6b354d3132ddb/Java_2019/TimeZoneDemo_getDSTSavings/?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
  • No comments:

    Post a Comment