Unix timestamps: seconds vs milliseconds

Recognize the unit, convert through UTC, and avoid timezone mistakes.

A Unix timestamp measures elapsed time from 1970-01-01 00:00:00 UTC. It identifies an instant without embedding a timezone.

Seconds and milliseconds

Operating-system tools often use seconds, while JavaScript commonly uses milliseconds. Multiplying seconds by 1,000 converts them to milliseconds.

UTC and local time

UTC is the shared reference. Local display applies the device's timezone and daylight-saving rules. ISO 8601 strings ending in Z represent UTC.

Automatic detection has limits

Digit length is convenient, not universal. Select the unit explicitly when the source format is known.