Skip to content

getUnixYear

getUnixYear(): string
import { getUnixYear } from "@northguild/gmt/unix/get";

Return the current year from the Unix timestamp in UTC as a zero-padded string.

  • Uses Temporal.Now.instant() converted to UTC zoned date time.
  • Returns zero-padded string to 4 digits.
  • Returns “” on failure.

current year string (zero-padded to 4 digits) or “” on failure

getUnixYear() // "2024"
getUnixYear() // "" (on failure)

unix/get/getUnixYear.ts