Wednesday 14 March 2018

How to use ofTotalSeconds method of ZoneOffset Class | Java 8 Date and Time


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

ZoneOffsetDemo.java

import java.time.ZoneOffset;

public class ZoneOffsetDemo
{

    public static void main(String[] args)
    {
        /*
         * Parameters:
         *
         * totalSeconds - the total time-zone offset in seconds, from
         * -64800 to +64800
         *
         * Returns:
         *
         * the ZoneOffset, not null
         */

        ZoneOffset zoneOffset = ZoneOffset.ofTotalSeconds(3600);
        System.out.println(zoneOffset);
    }

}

Output

+01:00

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

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

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