Package org.firebirdsql.gds.ng.tz

## Class TimeZoneMapping

- java.lang.Object
- - org.firebirdsql.gds.ng.tz.TimeZoneMapping

    public final class TimeZoneMapping
    extends java.lang.Object

Mapping of Firebird time zone ids.

Since:
  4.0
Author:
  Mark Rotteveel

### Constructor Summary

Constructors
`TimeZoneMapping()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static TimeZoneMapping` `getInstance()`
`boolean` `isOffsetTimeZone​(int timeZoneId)` Determines if `timeZoneId` is an offset time zone or - possibly - a named time zone.
`boolean` `isSupportedOffsetTimezone​(int timeZoneId)` Determines if `timeZoneId` is an offset time zone in the range supported by Jaybird [-18:00, +18:00].
`java.time.ZoneId` `timeZoneById​(int timeZoneId)` Maps a Firebird time zone id to a suitable Java `ZoneId`.
`int` `toOffsetMinutes​(int timeZoneId)` Return the offset in minutes for an offset time zone id
`int` `toTimeZoneId​(int offsetMinutes)` Return the Firebird time zone id for an offset in minutes.
`int` `toTimeZoneId​(java.time.ZoneOffset zoneOffset)` Returns the Firebird time zone id for a `ZoneOffset`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### TimeZoneMapping

    public TimeZoneMapping()

### Method Detail

#### getInstance

    public static TimeZoneMapping getInstance()

#### timeZoneById

    public java.time.ZoneId timeZoneById​(int timeZoneId)

Maps a Firebird time zone id to a suitable Java `ZoneId`.

The returned value is either a named time zone (zone region), or an offset zone (`ZoneOffset`).

Parameters:
  `timeZoneId` - Firebird time zone id (valid between between 0 and 65535)
Returns:
  `java.time.Zone` equivalent (out of range values or unmapped ids will return `UTC`).

#### isOffsetTimeZone

    public boolean isOffsetTimeZone​(int timeZoneId)

Determines if `timeZoneId` is an offset time zone or - possibly - a named time zone.

Parameters:
  `timeZoneId` - Firebird time zone id
Returns:
  `true` if this is an offset time zone, `false` otherwise

#### isSupportedOffsetTimezone

    public boolean isSupportedOffsetTimezone​(int timeZoneId)

Determines if `timeZoneId` is an offset time zone in the range supported by Jaybird [-18:00, +18:00].

Parameters:
  `timeZoneId` - Firebird time zone id
Returns:
  `true` if this is an offset time zone in the range [-18:00, +18:00]

#### toOffsetMinutes

    public int toOffsetMinutes​(int timeZoneId)

Return the offset in minutes for an offset time zone id

Parameters:
  `timeZoneId` - Offset time zone id (in range [0, 2878])
Returns:
  Offset in minutes, out of range values for `timeZoneId` will return `0` for UTC/GMT.

#### toTimeZoneId

    public int toTimeZoneId​(java.time.ZoneOffset zoneOffset)

Returns the Firebird time zone id for a `ZoneOffset`.

Parameters:
  `zoneOffset` - The zone offset
Returns:
  Firebird time zone id

#### toTimeZoneId

    public int toTimeZoneId​(int offsetMinutes)

Return the Firebird time zone id for an offset in minutes.

Parameters:
  `offsetMinutes` - Offset in minutes valid range [-1439, 1439] (or [-23:59, +23:59])
Returns:
  Time zone id encoding the specified offset, out of range values will return id for offset `0` (UTC)