Java ZoneOffset create via offset ID as a string

Description

Java ZoneOffset create via offset ID as a string

import java.time.ZoneOffset;

public class Main {
  public static void main(String[] args) {
    // Create zone offset using offset ID as a string
    ZoneOffset zos4 = ZoneOffset.of("+05:00");
    ZoneOffset zos5 = ZoneOffset.of("Z"); // Same as ZoneOffset.UTC
    System.out.println(zos4);/*from   w w w.  jav a 2s. co  m*/
    System.out.println(zos5);

  }
}



PreviousNext

Related