Skip to main content
Version: Java (Groovy)

parseTimeZoneQuiet

The parseTimeZoneQuiet method parses the supplied string as a time zone.

"Quiet" methods return null instead of throwing an exception when encountering a string that cannot be parsed.

Syntax

parseTimeZoneQuiet(s)

Parameters

ParameterTypeDescription
sstring

The string to be converted.

Returns

A ZoneId, or null if invalid input is given.

Examples

tz = parseTimeZoneQuiet("America/Los_Angeles")

tz2 = parseTimeZoneQuiet("Amurica/Los_Angeles")

println epochMillisToZonedDateTime(100, tz)

println epochMillisToZonedDateTime(100, tz2)