Java Date Time - ZoneId of(String zoneId, Map aliasMap) example








ZoneId of(String zoneId, Map<String,String> aliasMap) creates an instance of ZoneId using its ID using a map of aliases to supplement the standard zone IDs.

Syntax

of has the following syntax.

public static ZoneId of(String zoneId,  Map<String,String> aliasMap)

Example

The following example shows how to use of.

import java.time.ZoneId;
import java.util.HashMap;
/* w  w w .  ja  va  2  s.  c om*/
public class Main {
  public static void main(String[] args) {
    ZoneId z = ZoneId.of("UTC",new HashMap<>());
    
    System.out.println(z);
  } 
}

The code above generates the following result.