Java Date Time - ZoneId of(String zoneId) example








ZoneId of(String zoneId) creates an instance of ZoneId from an ID.

Syntax

of has the following syntax.

public static ZoneId of(String zoneId)

Example

The following example shows how to use of.

import java.time.ZoneId;

public class Main {
  public static void main(String[] args) {
    ZoneId z = ZoneId.of("UTC");
    
    System.out.println(z);
  } 
}

The code above generates the following result.