# convertUnixToUtc

Industry: Core

## Signature

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

Convert a unix epoch value to a UTC Instant ISO string.

- Converts to UTC Instant using Temporal.Instant.
- `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 "".

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` \| `number` | epoch value: a safe integer or a digit string |

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

UTC Instant string or "" on invalid

## Related types

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

## Examples

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

convertUnixToUtc(1709164800000) // "2024-02-29T00:00:00Z"
```

## Source

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