Tuesday, 16 January 2018

Java 8 LocalTime Class Introduction | Java 8 Date and Time | Java Date and Time


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

Click the below Image to Enlarge

Java 8 LocalTime Class Introduction | Java 8 Date and Time | Java Date and Time
LocalTimeDemo.java

import java.time.LocalTime;

public class LocalTimeDemo
{

    public static void main(String[] args)
    {
        /*
         * Returns:the current time using the system clock and default
         * time-zone, not null
         */

        LocalTime time = LocalTime.now();
        System.out.println(time);
        System.out.println("Hour = "+time.getHour());
        System.out.println("Min = "+time.getMinute());
        System.out.println("Seonds = "+time.getSecond());
        System.out.println("Nano = "+time.getNano());
    }

}

Output

09:42:52.761
Hour = 9
Min = 42
Seonds = 52
Nano = 761000000

Refer: 
https://docs.oracle.com/javase/8/docs/api/index.html?java/time/LocalTime.html

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

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

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