Skip to content

convertUnixToZoned

  • The core functions, which every industry uses.
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.
ParameterTypeDescription
valuestring | numberepoch value: a safe integer or a digit string
timeZonestringIANA name or a UTC offset to the minute (what isValidTimeZone accepts)

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 "".

zoned ISO 8601 string or "" on invalid

import { convertUnixToZoned } from "@northguild/gmt/unix/convert";
convertUnixToZoned(1709164800000, "Asia/Kolkata") // "2024-02-29T05:30:00+05:30[Asia/Kolkata]"
output 

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