Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng.tz

# Class TimeZoneMapping

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

public final class TimeZoneMapping extends Object
Mapping of Firebird time zone ids.

Since:
  4.0
Author:
  Mark Rotteveel

## Constructor Summary

Constructors
Constructor
Description
`TimeZoneMapping()`

## Method Summary

Modifier and Type
Method
Description
`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].
`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(ZoneId zoneId)`
Returns the Firebird time zone id for a `ZoneId`.
`int`
`toTimeZoneId(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 Details

### TimeZoneMapping

public TimeZoneMapping()

## Method Details

### getInstance

public static TimeZoneMapping getInstance()

### timeZoneById

public 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(ZoneOffset zoneOffset)
Returns the Firebird time zone id for a `ZoneOffset`.

Parameters:
  `zoneOffset` - The zone offset
Returns:
  Firebird time zone id
See Also:
  - `toTimeZoneId(ZoneId)`

### toTimeZoneId

public int toTimeZoneId(ZoneId zoneId)
Returns the Firebird time zone id for a `ZoneId`.

This method handles both `ZoneOffset` and named regions.

Parameters:
  `zoneId` - The zone id
Returns:
  Firebird time zone id
Since:
  4.0.1

### 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)