# getTimeZoneOffset

Industry: Core

## Signature

```ts
getTimeZoneOffset(timeZone: string, instant: string): string
```

Return a time zone's UTC offset at a given instant.

- Unlike `getZonedOffset`, this doesn't need an existing zoned value in hand — pass any timeZone identifier and an instant to look up, which is why (like `getDstTransitions`) it lives in `get/` despite taking two arguments: neither is a date *value* being described, both are coordinates for a zone-level lookup.
- Returns "" for an invalid timeZone or instant, including a leap second in any spelling (`23:59:60`, `t`/space separator, basic `235960`), which Temporal would read as `:59`. Compatibility: to look up the offset at the clamped `:59` instant as earlier releases did, pass that instant (`"2016-12-31T23:59:59Z"`), or call `Temporal.Instant.from(instant).toZonedDateTimeISO(timeZone).offset` directly.
- The instant is exactly ISO 8601 extended `<date>T<time>` then `Z` or `±HH:MM[:SS[.fraction]]`, over the whole string: basic format, a `t` or space separator, a lower-case `z`, an hour-only offset and an annotation of any kind (`[Asia/Tokyo]`, `[u-ca=iso8601]`, `[foo=bar]`) return "".
- The result is `±HH:MM`, or `±HH:MM:SS` where the zone was not on a whole minute (`Africa/Monrovia` stood at `-00:44:30` until 1972). It goes straight into the time zone position of any function whose result has no zone in it, and of this one: a UTC offset is its own answer at every instant, written without seconds when they are zero.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `timeZone` | `string` | IANA name or UTC offset: a time zone identifier (`+05:30`, `+0530`, `-08`) or a stored offset (`±HH:MM[:SS]`, what `getTimeZoneOffset` returns) |
| `instant` | `string` | ISO 8601 instant string (e.g. "2024-07-15T12:00:00Z") |

## Returns

offset string (e.g. "+10:00"), or "" on invalid input

## Examples

```ts
import { getTimeZoneOffset } from "@northguild/gmt/zoned/get";

getTimeZoneOffset("Australia/Sydney", "2024-07-15T12:00:00Z") // "+10:00"
```

## Source

[zoned/get/getTimeZoneOffset.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/zoned/get/getTimeZoneOffset.ts)
