Thursday, 5 April 2018

How to create an Instant object using parse method of Instant class | Java 8 Date and Time


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

InstantDemo.java

import java.time.Instant;

public class InstantDemo
{
    public static void main(String[] args)
    {

        /*
         * Parameters:
         *
         * text - the text to parse, not null
         *
         * Returns:
         *
         * the parsed instant, not null
         */

        Instant instant = Instant.parse("2017-12-03T10:15:30.00Z");
        System.out.println(instant);

    }

}

Output

2017-12-03T10:15:30Z

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

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

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