Monday 15 January 2018

How to use getEra method of Java 8 LocalDate Class | Java 8 Date and Time


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

LocalDateDemo.java

import java.time.LocalDate;
import java.time.chrono.Era;

public class LocalDateDemo
{

    public static void main(String[] args)
    {
        LocalDate date = LocalDate.parse("2017-11-23");

        /*
         * Returns:the IsoChronology era constant applicable at this
         * date, not null
         */

        Era era = date.getEra();
        System.out.println(era);
    }

}

Output

CE

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

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/f50b0477cba623e7ace08d1d7966409dcc9e7b40/BasicJava/LocalDateDemo_getEra/?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