How to Convert Unix Timestamps to Human-Readable Dates
Why Convert Unix Timestamps?
Unix timestamps are ideal for machines โ a single integer is compact, unambiguous, and easy to sort. But for humans, 1785292800 means nothing until it is translated into a calendar date and time. Whether you are debugging a log file, analyzing database records, or reading an API response, knowing how to convert timestamps quickly is an essential skill.
Method 1: Using Our Online Unix Timestamp Converter
The fastest and most reliable method is to use a dedicated conversion tool.
Our Unix Timestamp Converter accepts timestamps in both seconds and milliseconds, automatically detects the resolution, and displays the result across multiple timezones simultaneously. You can also go the other direction โ enter a human-readable date and get the corresponding Unix timestamp.
This approach is ideal when you need a quick one-off conversion without touching a command line.
Method 2: Using the Linux Command Line (date Command)
If you have access to a Linux or macOS terminal, the date command is your best friend.
Convert a Timestamp to a Human-Readable Date
# On GNU Linux (most distributions)
date -d @1785292800
# Specify a custom format
date -d @1785292800 +"%Y-%m-%d %H:%M:%S"
# Output: 2026-07-19 00:00:00
# With timezone
TZ="America/New_York" date -d @1785292800
# Output: Sun Jul 19 00:00:00 EDT 2026
On macOS (BSD date), the syntax differs slightly:
# On macOS
date -r 1785292800
# With custom format
date -r 1785292800 +"%Y-%m-%d %H:%M:%S"
Convert a Date to a Unix Timestamp
# On GNU Linux
date -d "2026-07-19 00:00:00" +%s
# On macOS
date -j -f "%Y-%m-%d %H:%M:%S" "2026-07-19 00:00:00" +%s
Method 3: Manual Calculation
While you should rarely need to do this by hand, understanding the math demystifies how the system works.
The Formula
seconds = (year - 1970) ร 31536000 + (month offset) ร 86400 + day ร 86400 + hours ร 3600 + minutes ร 60 + seconds
The tricky part is accounting for leap years. A year is a leap year if it is divisible by 4, except for century years not divisible by 400.
Quick Mental Approximations
- 86,400 seconds = 1 day
- 604,800 seconds = 1 week
- Approximately 31,536,000 seconds = 1 common year
- Approximately 31,622,400 seconds = 1 leap year
For a rough estimate, you can compute timestamp / 86400 to get the number of days since the epoch, then add those days to January 1, 1970.
Method 4: Using Programming Languages
Every major programming language has built-in functions for timestamp conversion. Here are the most common ones:
JavaScript (Browser or Node.js)
// Timestamp to date (JavaScript uses milliseconds)
const timestamp = 1785292800;
const date = new Date(timestamp * 1000);
console.log(date.toISOString());
// Output: 2026-07-19T00:00:00.000Z
// Date to timestamp
const ts = Math.floor(new Date("2026-07-19").getTime() / 1000);
console.log(ts);
// Output: 1785292800
Python
from datetime import datetime
# Timestamp to date
dt = datetime.utcfromtimestamp(1785292800)
print(dt.isoformat())
# Output: 2026-07-19T00:00:00
# Timezone-aware (Python 3.9+)
from zoneinfo import ZoneInfo
dt_tz = datetime.fromtimestamp(1785292800, tz=ZoneInfo("America/New_York"))
print(dt_tz.isoformat())
# Output: 2026-07-19T00:00:00-04:00
# Date to timestamp
import time
ts = time.mktime(datetime(2026, 7, 19).timetuple())
print(ts)
PHP
<?php
// Timestamp to date
echo date("Y-m-d H:i:s", 1785292800);
// Output: 2026-07-19 00:00:00
// Date to timestamp
echo strtotime("2026-07-19 00:00:00");
// Output: 1785292800
Method 5: Using Spreadsheet Software
Google Sheets
Use the formula =DATE(1970,1,1) + A1 / 86400 where A1 contains the timestamp. Format the result cell as a date.
Microsoft Excel
=DATE(1970,1,1) + A1 / 86400
On Windows Excel, you may need:
=(A1 / 86400) + DATE(1970,1,1)
Edge Cases to Watch For
Seconds vs Milliseconds
This is the most common mistake. If you pass a millisecond value (e.g., 1785292800000) to a function expecting seconds, you will get a date roughly 56,000 years in the future.
How to detect:
- If the number is 10 digits long, it is likely seconds
- If the number is 13 digits long, it is likely milliseconds
- Some systems also use microseconds (16 digits) or nanoseconds (19 digits)
Negative Timestamps (Dates Before 1970)
Unix timestamps can represent dates before the epoch using negative numbers:
date -d @-126230400
# Output: Tue Dec 31 00:00:00 -1969
Not all conversion tools handle negative timestamps correctly. Our online converter does.
Leap Seconds
Unix time ignores leap seconds by design. A Unix timestamp will never show :59:60 even during a leap second insertion. This means the timestamp diverges from atomic time by a small (currently 27 seconds) but growing amount.
Summary
| Method | Best For |
|--------|----------|
| Online converter (/linux-timestamp) | Quick, one-off conversions |
| date command | Terminal users and scripts |
| Manual calculation | Understanding how it works |
| Programming languages | Automation and apps |
| Spreadsheets | Data analysis |
Use our Unix Timestamp Converter to perform instant, accurate conversions with automatic timezone detection.