Package org.apache.solr.util
Class TimeZoneUtils
java.lang.Object
org.apache.solr.util.TimeZoneUtils
Simple utilities for working with TimeZones
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionAn immutable Set of all TimeZone IDs supported by the TimeZone class at the moment the TimeZoneUtils was initialized. -
Method Summary
Modifier and TypeMethodDescriptionstatic final TimeZonegetTimeZone(String ID) This method is provided as a replacement for TimeZone.getTimeZone but without the annoying behavior of returning "GMT" for gibberish input.static TimeZoneparseTimezone(String tzStr) Parse the specified timezone ID.
-
Field Details
-
KNOWN_TIMEZONE_IDS
An immutable Set of all TimeZone IDs supported by the TimeZone class at the moment the TimeZoneUtils was initialized.- See Also:
-
-
Method Details
-
getTimeZone
This method is provided as a replacement for TimeZone.getTimeZone but without the annoying behavior of returning "GMT" for gibberish input.This method will return null unless the input is either:
- Included in the set of known TimeZone IDs
- A "CustomID" specified as a numeric offset from "GMT"
- Parameters:
ID- Either a TimeZone ID found in KNOWN_TIMEZONE_IDS, or a "CustomID" specified as a GMT offset.- Returns:
- A TimeZone object corresponding to the input, or null if no such TimeZone is supported.
- See Also:
-
parseTimezone
Parse the specified timezone ID. If null input then return UTC. If we can't resolve it then throw an exception. Does not return null.
-