# getUnixNow

Industry: Core

## Signature

```ts
getUnixNow(options?: { epochUnit?: UnixUnit; }): number
getUnixNow(options?: unknown): number | null
```

Return the current Unix timestamp in either seconds or milliseconds.

- Uses Temporal.Now.instant() to get current time.
- An explicit `undefined` is the same as omitted. Options outside the type, an unknown `epochUnit` or a non-object such as a bare `"seconds"`, return null.
- Options whose `epochUnit` throws when read, such as a getter or a `Proxy`, also return null.

## Options

**options**

optional: the unit of the result

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `epochUnit?` | `"seconds"` \| `"milliseconds"` \| `"second"` \| `"millisecond"` ([`UnixUnit`](/gmt/reference/types/UnixUnit/)) | `"milliseconds"` | The unit of the returned epoch: `"seconds"` or `"milliseconds"`, singular or plural. Seconds floor toward −∞, as POSIX `time_t` counts whole elapsed seconds. Any other value is outside the type and returns `null`. |

## Returns

the current Unix timestamp; null for options outside the type or options that throw when read

## Related types

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

## Examples

```ts
import { getUnixNow } from "@northguild/gmt/unix/get";

getUnixNow() // 1700000000000
```

## Source

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