Developer7 min readUpdated 2026-06-19

How to Convert a Unix Timestamp to a Date (and Back)

You found a number like 1678886400 in a database, an API response, a log file, or a JWT — and you need to know what date it actually means. That number is a Unix timestamp: a count of seconds since a fixed moment in 1970. On its own it is unreadable, but converting it back into a normal date takes seconds once you know the one trick that trips almost everyone up.

This guide shows you how to convert a Unix timestamp to a date, how to convert a date back into a timestamp, and how to avoid the single most common mistake — mixing up seconds and milliseconds. You can do the whole thing right now with the free Timestamp Converter, which runs entirely in your browser so nothing you paste is ever uploaded.

What Is a Unix Timestamp?

A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970 — a moment programmers call "the epoch." So 1678886400 means "1,678,886,400 seconds after the start of 1970," which works out to March 15, 2023.

Why store dates this way? Because a single integer is unambiguous, easy to sort, easy to do math on, and free of timezone or formatting confusion. Every system can agree on the number, then display it in whatever local format the user needs. That is why you see Unix timestamps everywhere: SQL databases, REST APIs, server logs, cookies, and the iat/exp fields inside JWT tokens.

One thing it is not: a date in any particular timezone. The epoch is anchored to UTC. The timestamp itself carries no timezone — the timezone only appears when you convert it for display.

The Seconds vs Milliseconds Trap (Read This First)

This is the mistake that wastes more time than any other, so handle it before you convert anything.

Unix timestamps come in two common lengths:

  • Seconds — about 10 digits today (e.g. 1678886400). This is the classic Unix timestamp used by most databases, APIs, and command-line tools.
  • Milliseconds — about 13 digits today (e.g. 1678886400000). JavaScript, Java, and many front-end systems use this. It is just the seconds value with three extra digits on the end.

If you convert a value using the wrong unit, your date will be wildly off — usually landing in January 1970 (if you treated milliseconds as seconds) or thousands of years in the future (if you treated seconds as milliseconds). The fix is simple: count the digits. 10 digits = seconds, 13 digits = milliseconds.

ValueDigitsUnitResolves to
167888640010SecondsMar 15, 2023
167888640000013MillisecondsMar 15, 2023

Important — how FileNaut's converter expects input: the Timestamp Converter reads the timestamp field in milliseconds. If you have a standard 10-digit timestamp in seconds, multiply it by 1000 (in practice, add three zeros) before pasting — so 1678886400 becomes 1678886400000. Paste the 13-digit value and you'll get the correct date.

How to Convert a Unix Timestamp to a Date

Using the free Timestamp Converter:

  1. Open the Timestamp Converter and make sure the Timestamp to Date tab is selected.
  2. Check your number's length. If it's a 10-digit (seconds) timestamp, add three zeros to turn it into milliseconds — e.g. 16788864001678886400000. If it's already 13 digits, leave it as-is.
  3. Paste the value into the Timestamp (ms) field.
  4. Click Convert. The readable date and time appear instantly, shown in your computer's local timezone.
  5. Click the copy icon to grab the result.

Because everything runs in your browser, you can safely convert timestamps pulled from production logs or private databases — the data never leaves your device.

How to Convert a Date Back to a Unix Timestamp

Sometimes you need the reverse: you have a calendar date and you want the timestamp to store or query against.

  1. Open the Timestamp Converter and select the Date to Timestamp tab.
  2. Pick the date and enter the time (hours, minutes, seconds).
  3. Click Convert. You'll get the Unix timestamp in milliseconds (13 digits).
  4. If your system needs the value in seconds, drop the last three digits (divide by 1000). For example, 1678886400000 ms → 1678886400 seconds.

The date and time you enter are interpreted in your local timezone, so the resulting timestamp corresponds to that local moment.

Converting Timestamps in Code (Quick Reference)

If you'd rather convert in your own code, here are the one-liners. Remember the unit difference: most languages default to one or the other.

// JavaScript — uses milliseconds
new Date(1678886400 * 1000)        // timestamp (seconds) -> Date
Math.floor(Date.now() / 1000)      // now -> timestamp (seconds)

# Python — uses seconds
import datetime
datetime.datetime.utcfromtimestamp(1678886400)   # -> 2023-03-15 00:00:00
int(datetime.datetime.now().timestamp())          # now -> seconds

-- SQL (PostgreSQL) — uses seconds
SELECT to_timestamp(1678886400);

# Command line (Linux/macOS)
date -d @1678886400        # GNU/Linux
date -r 1678886400         # macOS / BSD

Notice JavaScript multiplies by 1000 because it works in milliseconds, while Python, SQL, and date expect seconds. That single difference is the seconds-vs-milliseconds trap in action.

A Note on Timezones

The timestamp itself is always anchored to UTC, but a readable date only makes sense in some timezone. Tools differ in what they show:

  • FileNaut's converter displays the result in your browser's local timezone — convenient for "what time was this for me?"
  • Many backend tools (like Python's utcfromtimestamp or SQL's to_timestamp) show UTC.

So the same timestamp can read as "March 15, 2023, 5:00 PM" on one tool and "March 16, 2023, 12:00 AM" on another — they're the same instant, just shown in different timezones. If a converted date looks a few hours off from what you expected, a timezone difference is almost always the reason, not a conversion error.

Tips

  • Count digits before converting. 10 = seconds, 13 = milliseconds. This one habit prevents the most common error.
  • Sanity-check the year. A modern timestamp should land in the 2020s. If you get 1970 or the year 50,000, you used the wrong unit.
  • Working with JWTs? The iat (issued-at) and exp (expiry) claims are Unix timestamps in seconds. Decode the token with the JWT Decoder, then convert those numbers to see when a token was issued or expires.
  • Reading API responses? Paste the whole payload into the JSON Formatter first to find the timestamp fields, then convert them.
  • Negative timestamps are valid — they represent dates before 1970.

Frequently Asked Questions

What is a Unix timestamp?
A Unix timestamp (or epoch time) is the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970. It's a simple integer used by databases, APIs, and programming languages to represent a specific moment in time without timezone or formatting ambiguity.
How do I convert a Unix timestamp to a date?
Paste the timestamp into the Timestamp Converter and click Convert. FileNaut's field reads milliseconds, so if you have a 10-digit timestamp (seconds), add three zeros first — e.g. 1678886400 becomes 1678886400000. The readable date appears instantly in your local timezone.
Why did my timestamp convert to a date in 1970?
Because a seconds value was read as milliseconds. A 10-digit seconds timestamp interpreted as milliseconds points to just a few weeks after the epoch — early 1970. Multiply your seconds value by 1000 (add three zeros) so it has 13 digits, then convert again.
What's the difference between seconds and milliseconds timestamps?
They measure the same moment at different resolutions. A seconds timestamp is about 10 digits today; a milliseconds timestamp is the same number with three extra digits (about 13 digits). JavaScript and many front-end systems use milliseconds; most databases, Python, and command-line tools use seconds.
How do I convert a date back into a Unix timestamp?
Use the Date to Timestamp tab in the Timestamp Converter, pick your date and time, and click Convert. You'll get the timestamp in milliseconds. If your system needs seconds, drop the last three digits (divide by 1000).
What timezone does the converted date use?
FileNaut shows the result in your browser's local timezone. The timestamp itself is anchored to UTC, so other tools may display the same instant in UTC instead. If a date looks a few hours off, it's a timezone display difference, not a conversion mistake.
Is it safe to convert timestamps from private data?
Yes. The Timestamp Converter runs entirely in your browser — nothing you paste is uploaded to any server. You can safely convert timestamps pulled from production logs, databases, or tokens.

Ready to try it?

Use the tool right now — free, no signup, no upload.