Tuesday 6 March 2018

How to use getRules method of ZoneId Class | Java 8 Date and Time


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

ZoneIdDemo.java

import java.time.ZoneId;
import java.time.zone.ZoneRules;

public class ZoneIdDemo
{

    public static void main(String[] args)
    {
        ZoneId zoneId = ZoneId.systemDefault();
        System.out.println(zoneId);

        /*
         * Returns:the rules, not null
         */

        ZoneRules zoneRules = zoneId.getRules();
        System.out.println(zoneRules);
    }

}

Output

Asia/Calcutta
ZoneRules[currentStandardOffset=+05:30]

Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ZoneIdDemo_getRules.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ZoneIdDemo_getRules

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/4bf907c20b634049430aea37cca3f8775ef090f9/BasicJava/ZoneIdDemo_getRules/?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
  • No comments:

    Post a Comment