Skip to content

getUnixNow

getUnixNow(unit?: UnixUnit): number
import { getUnixNow } from "@northguild/gmt/unix/get";

Return the current Unix timestamp in either seconds or milliseconds.

  • Uses Temporal.Now.instant() to get current time.
  • Defaults to “milliseconds” if no unit specified.
  • Returns 0 on failure.
Parameter Type Description
unit `` optional unit specifier: “seconds” | “milliseconds”

number (unix timestamp)

getUnixNow() // 1700000000000
getUnixNow("seconds") // 1700000000

unix/get/getUnixNow.ts