Thursday, 29 March 2018

How to use getChronology method of Period Class | Java 8 Date and Time


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

PeriodDemo.java

import java.time.Period;
import java.time.chrono.IsoChronology;

public class PeriodDemo
{

    public static void main(String[] args)
    {

        Period period = Period.ofMonths(12);
        /*
         * Returns:
         *
         * the ISO chronology, not null
         */

        IsoChronology  isoChronology  = period.getChronology();
        System.out.println(isoChronology.getId());

    }

}

Output

ISO

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

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/755fea7aeca931764d09d2ae6d0900a44d7186bb/BasicJava_2018/PeriodDemo_getChronology/?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
  • Cooking Tutorial
  • No comments:

    Post a comment