Java Date Time Java Java API
java.time.ZoneId
public static ZoneId of(String zoneId, Map<String,String> aliasMap)
Creates an instance of ZoneId using its ID and a map of aliases to supplement the standard zone IDs.
ZoneId
public static ZoneId of(String zoneId)
Creates an instance of ZoneId from the provided ID ensuring that the ID is valid and available for use.
package com.logicbig.example.zoneid;import java.time.ZoneId;import java.util.HashMap;public class OfExample { public static void main(String... args) { HashMap<String, String> aliasMap = new HashMap<>(); aliasMap.put("EST", "America/New_York"); ZoneId zoneId = ZoneId.of("EST", aliasMap); System.out.println(zoneId); }}
America/New_York
package com.logicbig.example.zoneid;import java.time.ZoneId;public class OfExample2 { public static void main(String... args) { ZoneId z = ZoneId.of("America/Phoenix"); System.out.println(z); }}
America/Phoenix