Unix Timestamps: Seconds vs Milliseconds Explained

What a Unix timestamp is, how to tell seconds from milliseconds, and how to convert epoch time without time zone mistakes.

Published November 18, 2026 unixtimedevelopers

A timestamp of 1763510400 and a timestamp of 1763510400000 are the same moment, one thousand times apart. Mixing the two is one of the most common date bugs in software, and it usually shows up as a date in 1970 or a date in the year 56000.

This guide covers what a Unix timestamp is, how to tell the two units apart at a glance, and how to convert epoch time without dragging time zones into the calculation.

What a Unix timestamp is

A Unix timestamp counts the seconds that have passed since 1970-01-01T00:00:00Z, also called the Unix epoch. It is a single number with no formatting, no month names and no time zone attached.

  • 0 is 1970-01-01T00:00:00Z.
  • 1763510400 is 2025-11-19T00:00:00Z.
  • The value is always UTC. There is no “local timestamp”.
  • It can be negative for dates before 1970.

Because it is just a number, it sorts correctly, compares with < and >, and takes the same space in every database. That is why APIs, logs and databases prefer it over formatted date strings.

Seconds or milliseconds?

Both units are in use, often in the same stack:

SourceUnitExample
Unix time(), most APIsseconds1763510400
JavaScript Date.now()milliseconds1763510400000
Java System.currentTimeMillis()milliseconds1763510400000
Python time.time()seconds, float1763510400.123
PostgreSQL extract(epoch from now())seconds1763510400
Swift/Objective-C Dateseconds since 2001786000000

The quick test is the number of digits:

  • 10 digits (about 1.7 billion) — seconds.
  • 13 digits (about 1.7 trillion) — milliseconds.
  • 16 digits (about 1.7 quadrillion) — microseconds.
  • 19 digits — nanoseconds.

Anything with 10 digits is seconds for any date between 2001 and 2286, so the heuristic is safe for the foreseeable future. When in doubt, compare against 100000000000: larger values are almost certainly milliseconds.

A float such as 1763510400.123 is seconds with a fractional part. Truncating it to 1763510400 loses the milliseconds; multiplying it by 1000 and calling Math.round keeps them.

The year 2038 problem

A signed 32-bit integer maxes out at 2,147,483,647, which is 2038-01-19T03:14:07Z. Systems that store a timestamp in a 32-bit INT column will overflow on that date and wrap to a negative value, usually interpreted as a date in 1901.

The fix is boring and effective: store timestamps in 64-bit integers (BIGINT, int64, long) and check old schemas before 2038. MySQL TIMESTAMP columns are already limited to 2038; DATETIME and BIGINT are not. If you maintain an embedded device or a legacy PHP service, this is worth an audit now rather than in 2037.

Timestamps do not have a time zone

A timestamp is an instant in UTC. The time zone only appears when you format it for a human:

const ts = 1763510400;

new Date(ts * 1000).toISOString();
// "2025-11-19T00:00:00.000Z"

new Date(ts * 1000).toLocaleString('en-US', { timeZone: 'America/New_York' });
// "11/18/2025, 7:00:00 PM"

new Date(ts * 1000).toLocaleString('en-US', { timeZone: 'Asia/Tokyo' });
// "11/19/2025, 9:00:00 AM"

Same number, three different wall-clock readings. If a user says “the report is dated yesterday”, check which time zone the report is rendered in before changing the data.

The bugs you will actually hit

  1. Seconds passed where milliseconds are expected. JavaScript’s new Date(1763510400) treats the argument as milliseconds and lands in January 1970. Multiply by 1000 first.
  2. Milliseconds passed where seconds are expected. A backend storing 1763510400000 in a seconds column produces a date roughly 56,000 years in the future.
  3. Date strings parsed as local time. new Date("2026-11-18") is parsed as UTC midnight, while new Date("2026-11-18T00:00:00") is parsed as local midnight. Prefer explicit timestamps or ISO strings with Z.
  4. Adding 86400 seconds to mean “tomorrow”. That is exactly 24 hours, which is not the same as the next calendar day when a daylight saving change happens. Add days with a calendar library, not with arithmetic on seconds.
  5. Storing timestamps in a 32-bit column. See 2038 above.
  6. Comparing clocks from different machines. Server clocks drift. For ordering events, use a monotonic counter or a database-generated timestamp rather than a value produced by the client.

Converting without mistakes

To move between units, multiply or divide by 1000 and be explicit about rounding:

seconds      → milliseconds   × 1000
milliseconds → seconds        ÷ 1000   (floor for display, round for precision)
seconds      → microseconds   × 1_000_000

When you need a human-readable date, convert the number first and format second. Doing it the other way around, parsing a formatted string and hoping it is in the right zone, is where most confusion starts.

The Timestamp Converter shows seconds, milliseconds, ISO 8601 and local time side by side, so you can paste a value and see immediately which unit it is. If you need to add or subtract days rather than seconds, the Date Calculator works in calendar days. And when the number is right but the displayed hour is wrong, the Time Zone Converter helps you confirm which zone you are actually looking at.

A short checklist

  1. Decide on one unit per API and write it in the field name, for example created_at_ms.
  2. Store 64-bit integers, never 32-bit.
  3. Keep timestamps in UTC and convert only at the display layer.
  4. Use ISO 8601 with an explicit offset when a timestamp must be readable.
  5. Add days with calendar arithmetic, not by adding 86400 seconds.
  6. Log the raw number next to the formatted date when debugging.

A timestamp is one of the simplest data types in computing, and almost every bug around it comes from the same two questions: which unit, and which time zone. Answer both explicitly and the class of bug disappears.

Tools mentioned in this article

Back to the blog