← Shiyong Toolkit

Shiyong Toolkit · Updated

Timestamp conversion: units, time zones and repeatable results

Distinguish seconds from milliseconds and understand UTC and local representations of the same instant.

What a timestamp represents

A Unix timestamp measures a time offset from January 1, 1970 at 00:00:00 UTC. Many APIs use seconds, while JavaScript Date uses milliseconds. A timestamp identifies an instant; the displayed calendar date and clock time also depend on the time zone. Two colleagues seeing different clock times may still be looking at the same instant.

Select the input unit explicitly

In Timestamp to Date mode, check whether the source documentation specifies seconds or milliseconds, then select that unit. Do not rely solely on the number of digits: historical dates, negative timestamps and specialized systems may not match familiar lengths. An input of 0 should identify the Unix epoch. An input of 1767225600 seconds should identify 2026-01-01T00:00:00Z; use it to check your unit selection.

Interpreting that same number as milliseconds produces a very different date. If a result unexpectedly falls near 1970, check units first. If it differs by whole hours, check time zones. Do not remove the last three digits before conversion if you need millisecond precision.

Convert a date back to a timestamp

Prefer an explicit format such as 2026-01-01T08:00:00+08:00. It represents the same instant as 2026-01-01T00:00:00Z. A date-time string without a time zone is generally interpreted in the browser's local environment, making it unsuitable for records that must reproduce the same instant across devices.

Date-only strings and strings containing a time can follow different interpretation rules. Include the full time and either Z or a numeric offset to reduce ambiguity. Before copying the result to an API, check whether it expects seconds, milliseconds or a date string.

Daylight saving and historical records

Some regions observe daylight saving time, which can make a local clock time nonexistent or repeat it twice on the same day. A local date and time without an offset cannot fully distinguish these cases. For appointments, attendance records or international events, preserve an explicit time zone or offset in the business system instead of only formatted text. This tool converts values; it does not provide a complete regional time-zone management system.

A repeatable checking process

Keep the original value and unit. Generate a UTC result, inspect its local representation when needed, then convert a date with an explicit offset back into a timestamp to check that it identifies the same instant. Correct invalid input instead of silently replacing it with the current time. The tool does not upload input, but time information can still reveal personal activity. Use fixed, non-sensitive dates in shared troubleshooting examples.

Try the tool

Open tool → · All tool guides