getUnixNow
Signature
Section titled “Signature”getUnixNow(unit?: UnixUnit): numberimport { 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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
unit |
`` | optional unit specifier: “seconds” | “milliseconds” |
Returns
Section titled “Returns”number (unix timestamp)
Related types
Section titled “Related types”Examples
Section titled “Examples”getUnixNow() // 1700000000000getUnixNow("seconds") // 1700000000