Monday, 7 January 2019

How to use setID(String ID) method of java.util.TimeZone class | Java Date and Time


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

TimeZoneDemo.java

import java.util.TimeZone;

public class TimeZoneDemo
{
    public static void main(String[] args)
    {
        TimeZone tzone = TimeZone.getDefault();
        System.out.println("Before Set, Time zone ID = " + tzone.getID());

        /*
         * Parameters:
         *
         * ID - the new time zone ID.
         */

        tzone.setID("GMT+10:00");

        System.out.println("After Set, Time zone ID  = " + tzone.getID());
    }
}

Output:

Before Set, Time zone ID = Asia/Calcutta
After Set, Time zone ID  = GMT+10:00

Click the below link to download the code:
https://sites.google.com/site/javaspringram2019/java_spring_2019/TimeZoneDemo_setID.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java_Spring_2019/tree/master/Java_2019/TimeZoneDemo_setID

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