Skip to content

isTimestampInSeconds

Checks if a timestamp is likely in seconds (Java/Unix style) vs milliseconds (JavaScript style)

Available since v1.9.0

import { isTimestampInSeconds } from '@helpers4/date';
isTimestampInSeconds(timestamp: number): boolean
ParameterTypeDescription
timestampnumberThe timestamp to check

boolean — True if timestamp appears to be in seconds

Returns true for timestamps that are likely in seconds (Java/Unix style).

isTimestampInSeconds(1737290400)
// => true

Normalize a Unix timestamp to milliseconds

Section titled “Normalize a Unix timestamp to milliseconds”

Converts a timestamp in seconds to JavaScript milliseconds.

normalizeTimestamp(1737290400)
// => 1737290400000

View source on GitHub