Skip to main content
Best Answer Hub logo Best Answer Hub.
Back to Playbooks
Best Answer Hub Playbooks · Developer Tools
Seconds or milliseconds? Get it right

Convert a Unix Timestamp Without the Off-by-1000 Bug

A plain guide to Unix time: what a timestamp is, why the same number is a date in 1970 or today depending on whether it is seconds or milliseconds, which timezone the result is in, what happens in 2038, and the leap-second detail most tools get wrong. The Best Answer Hub Timestamp Converter reads the value both ways and shows UTC and your local time, in your browser.

Convertboth directions
ExplainUTC and local
Freeno signup, no ads
1970
the Unix epoch: Jan 1, 00:00:00 UTC
POSIX
×1000
seconds to milliseconds, the classic bug
MDN
2038
when 32-bit timestamps overflow
Jan 19, 03:14:07 UTC
100%
runs in your browser
even offline

A Unix timestamp is a count of seconds since midnight UTC on January 1, 1970, and the single most common bug is feeding a seconds value where milliseconds are expected, which lands the date back in 1970. The Best Answer Hub Timestamp Converter reads a value in either unit, converts in both directions, and shows the result in UTC and your local time at once. This guide covers what a timestamp is, how to tell seconds from milliseconds, which timezone a result is in, what breaks in 2038, and why Unix time quietly ignores leap seconds.

Start here

What is the Best Answer Hub Timestamp Converter?

The Best Answer Hub Timestamp Converter is a single-page tool that turns a Unix timestamp or a date string into every format you need at once: Unix seconds, Unix milliseconds, ISO 8601, your local time, UTC, and a relative expression like "3 hours ago." It converts in both directions, auto-detects whether your value is in seconds or milliseconds, and runs entirely in your browser with the native JavaScript date methods, so nothing is sent to a server and it works offline. It needs no account and shows no ads. The tool sits in the Best Answer Hub Developer Toolbox and the wider Tools hub, is built and maintained by Shahbaz Ali Malik, and stays free because Best Answer Hub is funded by optional paid assessments rather than advertising.

The basics

What is a Unix timestamp?

A Unix timestamp is a single number that represents an instant in time as the count of seconds since the Unix epoch, midnight UTC on January 1, 1970. The POSIX standard defines the epoch precisely as "the time zero hours, zero minutes, zero seconds, on January 1, 1970 Coordinated Universal Time (UTC)," and a timestamp as a value that "approximates the number of seconds that have elapsed since the Epoch." Because it is a single integer in UTC, the same timestamp means the same instant everywhere in the world, which is exactly why databases, logs, and APIs store time this way. A timestamp of 0 is the epoch itself, and negative values are instants before 1970.

The classic bug

Seconds or milliseconds?

The difference is a factor of 1000, and getting it wrong is the most common timestamp mistake. Classic Unix time, used by Linux, most databases, and APIs, counts whole seconds. JavaScript counts milliseconds: "Date.now() returns the number of milliseconds elapsed since the epoch." Feed a seconds value into a milliseconds-based function and the date lands about twenty days after the epoch, in January 1970; feed milliseconds into a seconds-based one and it lands tens of thousands of years in the future. A quick rule of thumb for current dates: a 10-digit number is seconds, a 13-digit number is milliseconds. The Best Answer Hub Timestamp Converter detects the scale for you, so a pasted value is read correctly either way.

The off-by-1000 bug in JavaScript
new Date(1752278400) // WRONG: read as milliseconds, lands 21 Jan 1970 new Date(1752278400 * 1000) // right: seconds converted to ms, lands in 2025 Math.floor(Date.now() / 1000) // a JavaScript ms value back to Unix seconds

JavaScript expects milliseconds, so a 10-digit seconds value has to be multiplied by 1000 first. To go the other way, divide the millisecond value by 1000 and floor it. The Best Answer Hub Timestamp Converter handles both automatically.

Ten digits or thirteen
1752278400 10 digits = seconds 1752278400000 13 digits = milliseconds the same instant in 2025 Read a 10-digit value as milliseconds and the date lands in 1970.

A 10-digit value is seconds, a 13-digit value is milliseconds; both name the same moment. Reading one as the other is the off-by-1000 bug. Source: MDN, Date.now.

The other question

Which timezone is the converted date in?

The timestamp itself has no timezone: it is an absolute instant anchored to UTC, and only the display has a timezone. The same integer renders as one wall-clock time in UTC and a different one in your local zone, without the stored value ever changing. That is why a good converter shows both. The standard text format for the UTC instant is ISO 8601, profiled for the internet by RFC 3339 as strings like 2026-07-12T00:00:00Z, where the trailing Z marks UTC. The Best Answer Hub Timestamp Converter prints the ISO 8601 UTC string next to your local time, so you never have to guess which one a result is in.

The famous deadline

What happens to Unix timestamps in 2038?

Systems that store a Unix timestamp in a signed 32-bit integer run out of room on January 19, 2038. The maximum such value is 2,147,483,647 seconds, which is 03:14:07 UTC on that date; one second later the counter overflows and wraps to a negative number that reads as December 13, 1901 (Year 2038 problem). The fix is to store time in a signed 64-bit integer, which pushes the limit roughly 292 billion years out, and most 64-bit systems already do. The risk today lives in legacy code, embedded devices, and 32-bit fields in file formats. It is why 2147483647 is a number worth recognizing on sight.

The subtle one

Does Unix time count leap seconds?

No, and this is the detail most explanations skip. UTC occasionally inserts a leap second to stay aligned with the earth's rotation, but Unix time treats every day as exactly 86,400 seconds and ignores them. The POSIX rationale is explicit: "Coordinated Universal Time (UTC) includes leap seconds. However, in POSIX time (seconds since the Epoch), leap seconds are ignored (not applied)." That is why the standard calls a timestamp a value that only approximates the seconds since the epoch: it is an idealized count, off from true elapsed SI seconds by the couple dozen leap seconds added since 1972. For everyday conversion this never matters, but it is the reason Unix time is simple and monotonic.

A Unix timestamp is a value that approximates the number of seconds that have elapsed since the Epoch. Each and every day is accounted for by exactly 86,400 seconds.POSIX, The Open Group Base Specifications
Numbers to know

Common timestamp reference values

A handful of values come up often enough to be worth memorizing, and they double as a way to sanity-check a converter. Each row below is an exact conversion in UTC. If a tool disagrees with these, it is reading the unit wrong. The Best Answer Hub Timestamp Converter matches them and shows the working alongside.

Unix secondsISO 8601 (UTC)What it is
01970-01-01T00:00:00ZThe epoch itself
10000000002001-09-09T01:46:40ZOne billion seconds
12345678902009-02-13T23:31:30ZThe sequential-digits milestone
21474836472038-01-19T03:14:07ZSigned 32-bit maximum
-11969-12-31T23:59:59ZOne second before the epoch
The two-second sanity check

If a converted date looks like 1970, your value is probably seconds being read as milliseconds, so multiply by 1000. If it looks tens of thousands of years out, it is milliseconds being read as seconds, so divide by 1000. The digit count settles it: 10 digits is seconds, 13 is milliseconds.

The honest comparison

How is it different from other converters?

The difference is that the Best Answer Hub Timestamp Converter auto-detects the unit and shows UTC and your local time together by default, where many converters make you pick seconds or milliseconds first and show one zone at a time. It converts both directions, displays the live current epoch, and gets the 2038 and leap-second facts right. The table sets the usual experience next to this one.

What you getBest Answer HubTypical epoch converter
Auto-detects seconds vs millisecondsYesOften you must pick the unit
Shows UTC and local time togetherYes, by defaultOften one at a time
Converts both directionsYesUsually
Live current epochYesUsually
Runs in your browser, works offlineYesVaries
No signup, no adsYesOften ad-supported
Pair it with the rest of the toolbox

Timestamps usually turn up mid-task, so the Best Answer Hub Developer Toolbox keeps the neighbors close: a Cron Expression Generator for scheduling, a JSON Formatter for the payloads timestamps hide in, and a URL Encoder. Each runs in the browser and sends nothing.

Convert it now

Open the Timestamp Converter

Free, no signup, and calculated entirely in your browser. Paste a timestamp or a date, and read it in seconds, milliseconds, ISO 8601, UTC, and your local time at once.

Convert a timestamp
Good questions

Common questions about Unix timestamps

What is the Best Answer Hub Timestamp Converter?
The Best Answer Hub Timestamp Converter is a free, browser-based tool that converts a Unix timestamp or a date string into Unix seconds, Unix milliseconds, ISO 8601, local time, UTC, and relative time at once. It works in both directions, auto-detects seconds or milliseconds, and runs on your device with no signup and nothing uploaded.
What is a Unix timestamp?
A Unix timestamp is a single number that represents an instant as the count of seconds since the Unix epoch, midnight UTC on January 1, 1970. Because it is one integer in UTC, it means the same moment everywhere, which is why databases, logs, and APIs use it. The Best Answer Hub Timestamp Converter turns any value into readable dates.
What is the Unix epoch?
The Unix epoch is the reference point from which timestamps are counted: midnight UTC on January 1, 1970, as defined by the POSIX standard. A timestamp of 0 is exactly that moment, and negative values are instants before it. The Best Answer Hub Timestamp Converter can display any timestamp relative to this origin.
What is the difference between seconds and milliseconds in a timestamp?
It is a factor of 1000. Classic Unix time counts whole seconds, while JavaScript and many modern APIs count milliseconds. Mixing them is the most common timestamp bug. A rule of thumb for current dates is that a 10-digit value is seconds and a 13-digit value is milliseconds. The Best Answer Hub Timestamp Converter auto-detects the scale.
Why does my timestamp show a date in 1970?
Almost always because a seconds value was read as milliseconds. A 10-digit seconds value fed into a millisecond-based function lands about twenty days after the epoch, in January 1970. Multiply the value by 1000 first, or let the Best Answer Hub Timestamp Converter detect the unit and convert it correctly.
How can I tell if a timestamp is in seconds or milliseconds?
For current-era dates, count the digits: a 10-digit number is seconds and a 13-digit number is milliseconds. A seconds value read as milliseconds shows a date near 1970, and a milliseconds value read as seconds shows a date far in the future. The Best Answer Hub Timestamp Converter detects the unit so you do not have to.
How do I convert a Unix timestamp to a date?
Paste the timestamp into the Best Answer Hub Timestamp Converter and it instantly shows the human-readable date in ISO 8601, your local timezone, and UTC. It auto-detects whether the value is in seconds or milliseconds, so no manual multiplication or unit selection is needed.
How do I convert a date to a Unix timestamp?
Paste a date string such as an ISO 8601 value or a plain date into the Best Answer Hub Timestamp Converter and it returns the matching Unix timestamp in both seconds and milliseconds. It uses the JavaScript date parser, which understands ISO 8601 and common formats, all in your browser.
Which timezone is the converted date in?
The timestamp itself has no timezone; it is an absolute instant in UTC, and only the display has one. The same value renders as a different wall-clock time in UTC and in your local zone. The Best Answer Hub Timestamp Converter shows both at once, so you never have to guess which zone a result is in.
What is ISO 8601?
ISO 8601 is the international standard for writing dates and times as text, in the form 2026-07-12T00:00:00Z, where T separates the date from the time and Z marks UTC. RFC 3339 profiles it for internet use. It is the default output of JavaScript toISOString and of most JSON APIs. The Best Answer Hub Timestamp Converter outputs it alongside every other format.
What happens to Unix timestamps in 2038?
Systems storing a timestamp in a signed 32-bit integer overflow at 03:14:07 UTC on January 19, 2038, when the value reaches 2,147,483,647 seconds, then wrap to a date in December 1901. The fix is a signed 64-bit integer, which most modern systems already use. Legacy and embedded code is where the risk remains.
Does Unix time include leap seconds?
No. UTC inserts occasional leap seconds, but Unix time treats every day as exactly 86,400 seconds and ignores them, which the POSIX rationale states plainly. That is why a timestamp only approximates the true elapsed seconds since the epoch. For everyday conversion it never matters, and the Best Answer Hub Timestamp Converter follows the same standard behavior.
Can a Unix timestamp be negative?
Yes. A negative timestamp represents an instant before the epoch, so minus one is one second before midnight UTC on January 1, 1970. Both C and JavaScript support negative values. The Best Answer Hub Timestamp Converter handles dates before 1970 as well as after.
How is it different from epochconverter.com?
The Best Answer Hub Timestamp Converter auto-detects seconds versus milliseconds and shows UTC and your local time together by default, where many converters make you choose the unit first and show one zone at a time. It converts both directions, runs entirely in your browser, works offline, and shows no ads.
Is the Timestamp Converter free and does it work offline?
Yes. The Best Answer Hub Timestamp Converter is completely free with no usage limits and no signup, and after the page loads once it works with no internet connection because it uses only browser-native date methods. That also means your input never leaves your device.
People also read

Keep going

Sources

  • The Open Group Base Specifications (POSIX), Definitions, the Epoch (midnight UTC on January 1, 1970).
  • The Open Group Base Specifications (POSIX), Seconds Since the Epoch (a timestamp approximates seconds since the epoch; 86,400 seconds per day).
  • The Open Group Base Specifications (POSIX), Rationale (leap seconds are ignored in POSIX time).
  • MDN Web Docs, Date.now() and Date (JavaScript counts milliseconds since the epoch; the representable range).
  • IETF, RFC 3339, 2002 (the ISO 8601 date-time profile; the trailing Z for UTC).
  • Wikipedia, Year 2038 problem (signed 32-bit overflow at 03:14:07 UTC on 19 January 2038; the 64-bit fix).

Jump into the tools: Timestamp Converter, Developer Toolbox, Cron Expression Generator, and all Tools.

Built & maintained by Shahbaz Ali Malik Last updated: