java.time.ZoneOffset.toString() Method Example



Description

The java.time.ZoneOffset.toString() method outputs this zone as a String, using the normalized ID.

Declaration

Following is the declaration for java.time.ZoneOffset.toString() method.

public static ZoneOffset toString()

Return Value

a string representation of this offset, not null.

Example

The following example shows the usage of java.time.ZoneOffset.toString() method.

package com.tutorialspoint;

import java.time.ZoneOffset;

public class ZoneOffsetDemo {
   public static void main(String[] args) {
 
      System.out.println(ZoneOffset.of("Z").toString());  
   }
}

Let us compile and run the above program, this will produce the following result −

Z
Advertisements