Wednesday 4 April 2018

How to use from method of Duration class | Java 8 Date and Time


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

DurationDemo.java

import java.time.Duration;

public class DurationDemo
{
    public static void main(String[] args)
    {
        /*
         * Obtains an insta nce of Duration from a temporal amount.
         *
         * Parameters:
         *
         * amount - the temporal amount to convert, not null
         *
         * Returns:
         *
         * the equivalent duration, not null
         */

        Duration duration = Duration.from(Duration.ZERO);
        System.out.println(duration);

    }

}

Output

PT0S

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

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

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