Skip to content

parseSecondFromUnix

parseSecondFromUnix(value: string | number, options?: { epochUnit?: UnixUnit; timeZone?: string; }): string
import { parseSecondFromUnix } from "@northguild/gmt/unix/parse";

Return the second (0-59) from a unix epoch value.

  • Delegates to {@link parseUnitFromUnix} with unit “second”.
  • Returns “” for invalid input.
Parameter Type Description
value string | number unix epoch in milliseconds or seconds (number or string)

options

Option Type Default
epochUnit? UnixUnit
timeZone? string

Second (00-59) or “” on invalid input

parseSecondFromUnix(1700000000000) // "26"
parseSecondFromUnix(-86400, { epochUnit: "seconds" }) // "00"

unix/parse/parseSecondFromUnix.ts