Wednesday, 7 March 2018

How to use ofOffset method of ZoneId Class | Java 8 Date and Time


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

ZoneIdDemo.java

import java.time.ZoneId;
import java.time.ZoneOffset;

public class ZoneIdDemo
{

    public static void main(String[] args)
    {

        /*
         * Parameters:
         *
         * prefix - the time-zone ID, not null
         *
         * offset - the offset, not null
         *
         * Returns:
         *
         * the zone ID, not null
         */

        ZoneId zoneId = ZoneId.ofOffset("UTC", ZoneOffset.UTC);

        System.out.println(zoneId);
    }

}

Output

UTC

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

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

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