Skip to content

convertUnixToUtc

  • The core functions, which every industry uses.
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 "".
ParameterTypeDescription
valuestring | numberepoch value: a safe integer or a digit string

options

optional: how value is read

OptionTypeDefaultDescription
epochUnit?"seconds" | "milliseconds" | "second" | "millisecond" (UnixUnit)"milliseconds"The unit the epoch values are counted in: "seconds" or "milliseconds", singular or plural. Any other value returns "".

UTC Instant string or "" on invalid

import { convertUnixToUtc } from "@northguild/gmt/unix/convert";
convertUnixToUtc(1709164800000) // "2024-02-29T00:00:00Z"
output 

unix/convert/convertUnixToUtc.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.