Skip to content

getUnixNow

  • The core functions, which every industry uses.
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

optional: the unit of the result

OptionTypeDefaultDescription
epochUnit?"seconds" | "milliseconds" | "second" | "millisecond" (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.

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

import { getUnixNow } from "@northguild/gmt/unix/get";
getUnixNow() // 1700000000000
output 

unix/get/getUnixNow.ts

Accessibility
© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.