Wednesday 31 October 2018

How to use getTimeZone() method of Java.util.GregorianCalendar class | Java Date and Time


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

GregorianCalendarDemo.java

import java.util.GregorianCalendar;
import java.util.TimeZone;

public class GregorianCalendarDemo
{
    public static void main(String[] args)
    {
        GregorianCalendar cal = (GregorianCalendar) GregorianCalendar
                .getInstance();

        /*
         * Returns:the time zone object associated with this calendar.
         */

        TimeZone timeZone = cal.getTimeZone();
        System.out.println("Time Zone = " + timeZone.getDisplayName());

    }
}

Output

Time Zone = India Standard Time

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

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/ca178d0280357a5fff33a91716acad6f25ed6390/BasicJava_2018/GregorianCalendarDemo_getTimeZone/?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