How to Convert Unix Timestamps Into Readable Dates

A Unix timestamp is the number of seconds that have passed since January 1, 1970, at 00:00:00 UTC, not counting leap seconds. To convert one into a readable date, turn the timestamp into a date and time using a converter, spreadsheet formula, programming language, or command-line tool.

For example, the Unix timestamp 1766678400 represents December 25, 2025, 12:00:00 PM UTC.

Understand Unix Timestamps

Unix timestamps are widely used in databases, APIs, log files, and web applications because they provide a simple way to store points in time.

There are two common versions:

Timestamp type Unit Example
Seconds Seconds since January 1, 1970 UTC 1766678400
Milliseconds Milliseconds since January 1, 1970 UTC 1766678400000

A 13-digit timestamp is usually in milliseconds. A 10-digit timestamp is usually in seconds. Before converting, check which format you have; otherwise, your result may be thousands of years off.

Convert a Timestamp With an Online Tool

Online Unix timestamp converters are the quickest option.

  1. Copy the Unix timestamp.
  2. Open a timestamp-to-date converter.
  3. Paste the timestamp into the input field.
  4. Select whether it is in seconds or milliseconds, if the tool asks.
  5. View the converted UTC date and time.
  6. Check the local time zone conversion if you need it.

A timestamp represents an exact moment in time, but its displayed date depends on the time zone. The same timestamp can be December 25 at noon in UTC, early morning in New York, and late evening in Tokyo.

Convert Timestamps in Excel or Google Sheets

Spreadsheets can convert Unix timestamps using simple formulas.

Convert seconds to a date

If the timestamp is in cell A2, use:

=A2/86400 + DATE(1970,1,1)

There are 86,400 seconds in a day.

Convert milliseconds to a date

If the timestamp is in milliseconds, use:

=A2/86400000 + DATE(1970,1,1)

After entering the formula, format the result cell as a date and time.

Example

Unix timestamp Formula Result in UTC
1766678400 =A2/86400+DATE(1970,1,1) 2025-12-25 12:00:00
1766678400000 =A2/86400000+DATE(1970,1,1) 2025-12-25 12:00:00

If the result appears as a number, change the cell format to Date or Date and time.

Convert Timestamps in JavaScript

JavaScript uses milliseconds for its built-in Date object.

Convert seconds

const timestamp = 1766678400;
const date = new Date(timestamp * 1000);
console.log(date.toISOString());

Output:

2025-12-25T12:00:00.000Z

Convert milliseconds

const timestamp = 1766678400000;
const date = new Date(timestamp);
console.log(date.toISOString());

To display the date in the user’s local time zone:

console.log(date.toLocaleString());

The exact output depends on the device’s time zone and language settings.

Convert Timestamps in Python

Python’s datetime module works with seconds by default.

Convert seconds

from datetime import datetime, timezone

timestamp = 1766678400
date = datetime.fromtimestamp(timestamp, tz=timezone.utc)
print(date)

Output:

2025-12-25 12:00:00+00:00

Convert milliseconds

Divide by 1,000 first:

from datetime import datetime, timezone

timestamp = 1766678400000
date = datetime.fromtimestamp(timestamp / 1000, tz=timezone.utc)
print(date)

To convert to a specific time zone, use a timezone-aware datetime library or specify the desired zone if your setup supports it.

Convert Timestamps on the Command Line

macOS or Linux

To convert a timestamp in seconds:

date -u -d @1766678400

On macOS, the command may be:

date -u -r 1766678400

The -u option displays the result in UTC.

Windows PowerShell

[DateTimeOffset]::FromUnixTimeSeconds(1766678400).UtcDateTime

For milliseconds:

[DateTimeOffset]::FromUnixTimeMilliseconds(1766678400000).UtcDateTime

Convert Readable Dates Back to Unix Timestamps

You may also need to convert a date into a timestamp.

In JavaScript

const date = new Date("2025-12-25T12:00:00Z");
const timestamp = Math.floor(date.getTime() / 1000);
console.log(timestamp);

Output:

1766678400

In Python

from datetime import datetime, timezone

date = datetime(2025, 12, 25, 12, 0, 0, tzinfo=timezone.utc)
timestamp = int(date.timestamp())
print(timestamp)

Output:

1766678400

In Excel or Google Sheets

To convert a date and time in cell A2 to a Unix timestamp in seconds:

=(A2-DATE(1970,1,1))*86400

Make sure A2 contains a proper date-time value, not text.

Handle Time Zones Correctly

A Unix timestamp always refers to the same moment in time, but the readable date changes by time zone.

For timestamp 1766678400:

Time zone Readable time
UTC December 25, 2025, 12:00 PM
New York December 25, 2025, 7:00 AM
London December 25, 2025, 12:00 PM
India December 25, 2025, 5:30 PM
Tokyo December 25, 2025, 9:00 PM

The exact local result can change during daylight saving time. When precision matters, store and share timestamps in UTC, then convert to local time only for display.

Common Mistakes to Avoid

Confusing seconds and milliseconds

A 10-digit timestamp is usually in seconds. A 13-digit timestamp is usually in milliseconds. If you treat milliseconds as seconds, the converted date may appear far in the future.

Ignoring time zones

A timestamp does not include a time zone. Always specify whether you want UTC or a local time zone when displaying the result.

Using the wrong epoch date

Unix time starts at January 1, 1970, 00:00:00 UTC. Using a different starting date will produce incorrect results.

Assuming timestamps are always in seconds

Some systems, APIs, and JavaScript environments use milliseconds. Check the documentation or look at the number of digits.

Rounding too early

When converting milliseconds to seconds, divide by 1,000 before formatting the date. Avoid rounding in a way that loses important seconds.

Quick Reference

Task Method
Convert seconds to date Use a timestamp converter or divide by 86,400 in a spreadsheet
Convert milliseconds to date Divide by 1,000 first, then convert
Excel seconds conversion =A2/86400+DATE(1970,1,1)
Excel milliseconds conversion =A2/86400000+DATE(1970,1,1)
JavaScript seconds conversion new Date(timestamp * 1000)
Python seconds conversion datetime.fromtimestamp(timestamp, tz=timezone.utc)

First determine whether the timestamp is in seconds or milliseconds. Then convert it to UTC, check the time zone you need for display, and use a spreadsheet formula, programming language, or converter to produce the readable date.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles