Here you can find the source of getTimezone(String tzid)
Parameter | Description |
---|---|
tzid | The timezone identifier |
public static ZoneId getTimezone(String tzid)
//package com.java2s; //License from project: Open Source License import java.time.ZoneId; public class Main { /**/* ww w . j a v a 2s . co m*/ * Get the ZoneId of a String that could be a valid tzid. * * @param tzid The timezone identifier * @return The ZoneId of the parsed timezone identifier, or "America/New_York" if tzid is invalid. */ public static ZoneId getTimezone(String tzid) { try { return ZoneId.of(tzid); } catch (Exception e) { return ZoneId.of("America/New_York"); } } }