zeed
    Preparing search index...

    Function timestampMillisecondsToSeconds

    • Convert a timestamp in milliseconds to seconds.

      When smart is true the function will try to detect already-second timestamps and return them unchanged (heuristic threshold). For example, small numbers (< 1e12) are likely seconds and are returned as-is.

      Parameters

      • ts: number

        timestamp in milliseconds or seconds

      • smart: boolean = true

        enable heuristic detection (default: true)

      Returns number

      timestamp in seconds