Package net.time4j.tz

Interface TZID

All Known Subinterfaces:
StdZoneIdentifier
All Known Implementing Classes:
AFRICA, AMERICA, AMERICA.ARGENTINA, AMERICA.INDIANA, AMERICA.KENTUCKY, AMERICA.NORTH_DAKOTA, ANTARCTICA, ASIA, ATLANTIC, AUSTRALIA, EUROPE, INDIAN, MilitaryZone, PACIFIC, ZonalOffset

public interface TZID

Identifies a timezone.

In most cases, the timezone ID has the Olson-format "{region}/{city}" or is an offset in the format "UTC±hh:mm". In latter case applications can instead directly use an instance of type ZonalOffset, especially if the timezone offset for a given timepoint is already known.

Provider-specific keys have the name of the provider followed by the separator char "~" and the normal canonical identifier. This form can be used if a custom registered ZoneModelProvider shall be used instead of the default provider for lookup of the zonal data. For example following key will search the timezone data via the API of java.util.TimeZone even if there is configured another default zone provider: "java.util.TimeZone~Europe/Berlin"

Lexical comparisons of IDs should always be done by the method canonical() because an object of type TZID is only designed for encapsulating a canonical name. The comparison using the method equals() is not allowed.

If a timezone offset is known for historical timezones before the year 1970 then users should generally prefer the class ZonalOffset because the timezone data associated with the enum constants are not necessarily correct.

Specification: All implementations must be immutable and serializable.

Author:
Meno Hochschild
  • Method Summary

    Modifier and Type
    Method
    Description
    Represents the full canonical name of a timezone (for example "Europe/Paris" or "UTC+01:00").
  • Method Details

    • canonical

      String canonical()

      Represents the full canonical name of a timezone (for example "Europe/Paris" or "UTC+01:00").

      Returns:
      String in TZDB format (Olson-ID) or in canonical offset format