Skip to content

PgTimeZone

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Resolves PostgreSQL timezone names and abbreviations using the backend’s timezone database.

public static class PgTimeZone

Inheritance: object

Gets the offset east of UTC for a named zone at the current transaction’s start instant.

public static TimeSpan GetOffset(string zone)

Parameters:

zone — string

A PostgreSQL timezone name, abbreviation, or POSIX timezone specification.

Returns: TimeSpan

The offset, including historical seconds where applicable.

Requires the active backend thread. Fixed abbreviations retain their fixed offsets; dynamic abbreviations and full zone names resolve at transaction start.

Gets the offset east of UTC for a named zone at a particular finite instant.

public static TimeSpan GetOffset(string zone, PgTimestampTz instant)

Parameters:

zone — string

A PostgreSQL timezone name, abbreviation, or POSIX timezone specification.

instant — PgTimestampTz

The instant at which to resolve historical and daylight-saving rules.

Returns: TimeSpan

The offset, including historical seconds where applicable.

Exceptions:

Requires the active backend thread and leaves the session timezone unchanged. PostgreSQL’s native timezone routines determine behavior across its complete timestamp range.