Unix Timestamp in Milliseconds: What It Is, How It Converts, and When to Keep the Raw Number
How millisecond Unix timestamps differ from seconds, what converting one to a readable date changes, and how to share times without ambiguity.
What a millisecond Unix timestamp is
A Unix timestamp counts the time elapsed since the Unix epoch, 00:00:00 UTC on 1 January 1970. The classic form counts seconds. The millisecond form counts thousandths of a second, so the same instant expressed in milliseconds is the seconds value multiplied by 1,000. JavaScript's Date.now() and Java's System.currentTimeMillis() return milliseconds. The POSIX time() function and many command-line tools work in seconds.
Unix time does not count leap seconds. Every day is treated as exactly 86,400 seconds. The value also has no time zone. The number identifies one instant everywhere on Earth, and only its human-readable rendering depends on where and how it is displayed.
Is converting a millisecond timestamp the right move for your use?
Convert to a readable date whenever a person needs to read, check or communicate the time. A raw 13-digit number is nearly impossible to judge by eye, while a formatted date can be verified at a glance.
The cost of converting is that a readable date depends on choices the number avoids, namely the time zone, the locale and the format. Each of these choices can introduce ambiguity, and a format that omits milliseconds discards precision.
Keep the plain integer when the value goes to another program, a database, an API, a sort operation or log correlation. A practical rule is to store and exchange either the integer or an ISO 8601 string in UTC, and to localize only at the moment of display.
What the conversion actually changes
Converting a timestamp is arithmetic plus formatting. It is not a character transformation. Nothing is reversed digit by digit, nothing is mirrored, and no stylized Unicode characters are substituted. When a converter offers a 'reverse' mode, it almost always means the opposite direction, from a date back to a timestamp.
| Operation | What changes in the stored data | What stays the same |
| Seconds to milliseconds | The value is multiplied by 1,000 and gains three digits | The instant |
| Milliseconds to seconds | The value is divided by 1,000, and the remainder is dropped or kept as a decimal | The instant, to the second or better |
| Timestamp to a date string | New text is created, with a chosen zone, locale and format | The instant, provided the zone or offset is recorded |
| Localized display (locale formatting, CSS, bidirectional rendering) | Only the visual presentation | The stored characters |
Here is a worked example. The value 1700000000000 in milliseconds equals 1700000000 in seconds, which is 2023-11-14T22:13:20.000Z. In US Eastern time that is 5:13:20 PM on 11/14/2023, because the zone was on standard time (UTC−5) in mid-November that year.
// JavaScript
const ms = 1700000000000;
new Date(ms).toISOString(); // "2023-11-14T22:13:20.000Z"
new Date(ms).toLocaleString("en-US", { timeZone: "America/New_York" });
// "11/14/2023, 5:13:20 PM"
# Python
from datetime import datetime, timezone
datetime.fromtimestamp(1700000000000 / 1000, tz=timezone.utc).isoformat()
# '2023-11-14T22:13:20+00:00'
Digit count tells seconds and milliseconds apart for dates between September 2001 and November 2286. In that range, seconds values have 10 digits and millisecond values have 13. Older dates have fewer digits, so the rule does not apply to them.
The typical mix-up is easy to recognize. If a millisecond value is read as seconds, the result lands tens of thousands of years in the future. If a seconds value is read as milliseconds, the result lands in January 1970.
Integer size matters too. A millisecond timestamp does not fit in a signed 32-bit integer, so it needs a 64-bit type. Signed 32-bit seconds counters overflow in January 2038.
Millisecond values are well within the range that JavaScript numbers represent exactly, which ends at 2^53 − 1. Nanosecond timestamps exceed that limit, so they lose precision in any language or JSON parser that stores numbers as doubles. Microsecond timestamps are 16 digits and also exist in practice.
Will the result stay readable and usable after copying or sharing?
A raw timestamp is plain ASCII digits, so it usually copies cleanly. Copies break in three common ways. Locale formatting can insert digit grouping, such as commas in US English, periods or spaces in other locales, and sometimes a narrow no-break space, after which the value no longer parses as an integer. Spreadsheets may display long integers in scientific notation or reformat them, so set the column to text or an explicit number format. Stray whitespace picked up during copying can also cause a parse failure.
A readable date carries locale ambiguity. For example, 03/04/2024 means March 4 in the US but 3 April in much of the world. A 12-hour clock with AM/PM can be misread by readers who expect a 24-hour clock. Time zone abbreviations are not unique; CST, for instance, is used for more than one zone. For anything shared across regions, an ISO 8601 string with Z or an explicit UTC offset avoids these problems. A local format is fine inside an interface aimed at a single locale.
Some locale formatters output native digits, such as Arabic-Indic or Devanagari numerals. These display correctly, but many parsers accept only ASCII digits 0 to 9, so localized output should not be fed back into code.
In right-to-left text, a run of digits still reads left to right, but neighboring separators and punctuation can appear visually reordered. This affects only the display, not the stored characters. Wrapping the value in directional isolate characters (U+2068 and U+2069) or an isolated element keeps it visually intact. Those invisible isolate characters are copied along with the value, however, and can break parsers that expect bare digits.
A bare 13-digit number is hard for anyone to read aloud or verify. Screen readers may announce it as one very large number or digit by digit, depending on the product and its settings. No scoped assistive-technology test was performed for this review, so no specific screen reader behavior is claimed here.
For human audiences, provide a readable date. In HTML, the time element with a datetime attribute can show a localized date while keeping a machine-readable ISO value alongside it.
Search and editing are affected as well. Searching logs for a calendar date will not match raw timestamps, and searching for a timestamp will not match formatted dates. When both people and programs need the value, keep both forms.
Plain number or readable date: a quick guide
- Storage, APIs, sorting and computing durations: keep the millisecond integer, or use ISO 8601 in UTC.
- Sharing a time across regions: use ISO 8601 with Z or an explicit offset, optionally with a local rendering beside it.
- A single-locale interface for people: use a localized date and time, with the time zone shown when it could be unclear.
- Anything a parser will read later: use ASCII digits only, with no grouping separators, native numerals or invisible direction marks.
- Precision finer than milliseconds: use a 64-bit integer or a string, and avoid double-precision number types.
Gaps in this review
No specific converter tool was evaluated, so nothing here describes any particular tool's accuracy, privacy or data retention. Before trusting a converter's output, check whether it interprets input as seconds or milliseconds and whether it displays results in UTC or in the device's local time zone.