convertUnixToPlainTime
Signature
Section titled “Signature”convertUnixToPlainTime(unix: number, options?: { epochUnit?: "seconds" | "milliseconds"; timeZone?: string; }): stringimport { convertUnixToPlainTime } from "@northguild/gmt/unix/convert";Convert a Unix timestamp to a plain time string in the format “HH:mm:ss”.
- Converts to PlainTime using the specified or system timezone.
- Validates epoch unit (“seconds” | “milliseconds”).
- Returns “” for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
unix |
number |
Unix timestamp (number) |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
epochUnit? |
"seconds" | "milliseconds" |
— |
timeZone? |
string |
— |
Returns
Section titled “Returns”plain time string in “HH:mm:ss” format or “” on invalid input
Examples
Section titled “Examples”convertUnixToPlainTime(1706659200000) // "00:00:00"convertUnixToPlainTime(1706659200, { epochUnit: "seconds" }) // "00:00:00"convertUnixToPlainTime(-1) // "23:59:59.999"