convertUnixToPlainTime
Signature
Section titled “Signature”convertUnixToPlainTime(unix: string | number, options?: { epochUnit?: UnixUnit; timeZone?: string; }): stringConvert a Unix timestamp to a plain time string in the format “HH:mm:ss”.
- Converts to PlainTime in
timeZone. unixis a safe integer or a string of optionally negative ASCII digits; anything else returns "".- Returns "" for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
unix | string | number | Unix epoch: a safe integer or a digit string |
Options
Section titled “Options”options
optional: how unix is read and the zone its wall clock is read in
| Option | Type | Default | Description |
|---|---|---|---|
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 "". |
timeZone? | string | "UTC" | The time zone the wall-clock fields are read in: an IANA name, a UTC offset (a time zone identifier such as +05:30, +0530 or -08, or a stored offset ±HH:MM[:SS], what getTimeZoneOffset returns), or "local" for the system time zone. An unknown zone returns "". |
Returns
Section titled “Returns”plain time string in “HH:mm:ss” format or "" on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”import { convertUnixToPlainTime } from "@northguild/gmt/unix/convert";
convertUnixToPlainTime(1706659200000, { timeZone: "UTC" }) // "00:00:00"