# convertUnixToZoned

Industry: Core

## Signature

```ts
convertUnixToZoned(value: string | number, timeZone: string, options?: { epochUnit?: UnixUnit; }): string
```

Convert a unix epoch value to a zoned ISO 8601 datetime string.

- Converts to ZonedDateTime using the specified timezone (required; an unknown zone returns "").
- `value` is a safe integer or a string of optionally negative ASCII digits; anything else, or an instant outside the Temporal range, returns "".
- An explicit `undefined` `options` is the same as omitted; a non-object `options` (such as a bare `"seconds"` string) returns "".
- An offset with seconds (`-00:44:30`) returns `""`. A written zone cannot carry seconds (RFC 9557 §4.1), so the result could not name it. Pass the IANA name, or call `fromOffsetInstant({ instant, offset })` for the local time with its full offset and no bracket.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` \| `number` | epoch value: a safe integer or a digit string |
| `timeZone` | `string` | IANA name or a UTC offset to the minute (what `isValidTimeZone` accepts) |

## Options

**options**

optional: how `value` is read

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `epochUnit?` | `"seconds"` \| `"milliseconds"` \| `"second"` \| `"millisecond"` ([`UnixUnit`](/gmt/reference/types/UnixUnit/)) | `"milliseconds"` | The unit the epoch values are counted in: `"seconds"` or `"milliseconds"`, singular or plural. Any other value returns `""`. |

## Returns

zoned ISO 8601 string or "" on invalid

## Related types

- [`UnixUnit`](/gmt/reference/types/UnixUnit/)

## Examples

```ts
import { convertUnixToZoned } from "@northguild/gmt/unix/convert";

convertUnixToZoned(1709164800000, "Asia/Kolkata") // "2024-02-29T05:30:00+05:30[Asia/Kolkata]"
```

## Source

[unix/convert/convertUnixToZoned.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/unix/convert/convertUnixToZoned.ts)
