How to Convert a Unix Timestamp to a Human-Readable Date
Updated: May 2026
Converting a Unix timestamp to a readable date is a fundamental task in every language. The mechanics are always the same — multiply by 1000 if needed, pass to the platform's date API, format with the right locale and timezone — but the exact syntax varies. This guide covers the most common environments.
Free · No upload · Instant
The core concept
A Unix timestamp counts seconds from the epoch (January 1, 1970 UTC). To display it as a date you need to: (1) multiply by 1000 if your runtime expects milliseconds, (2) pass the value to the platform's date object or function, (3) choose a timezone for display, and (4) format the result into a string.
Steps 1 and 3 are the most common sources of bugs. A 10-digit timestamp is always in seconds; a 13-digit one is in milliseconds. The timezone only changes the display — the underlying moment is the same everywhere on Earth.
JavaScript / TypeScript
The Date constructor expects milliseconds, so multiply seconds by 1000.
const ts = 1735689600; // seconds
const date = new Date(ts * 1000);
// UTC string
console.log(date.toUTCString());
// → "Wed, 01 Jan 2025 00:00:00 GMT"
// ISO 8601
console.log(date.toISOString());
// → "2025-01-01T00:00:00.000Z"
// Locale-aware with timezone
console.log(date.toLocaleString('en-US', {
timeZone: 'America/New_York',
dateStyle: 'long',
timeStyle: 'short'
}));
// → "January 1, 2025 at 7:00 PM"
// Intl.DateTimeFormat for full control
const fmt = new Intl.DateTimeFormat('en-GB', {
timeZone: 'Europe/Paris',
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
hour12: false
});
console.log(fmt.format(date));
// → "01/01/2025, 01:00:00"
Python
Use datetime.utcfromtimestamp() for UTC or datetime.fromtimestamp(ts, tz) to apply a timezone.
from datetime import datetime, timezone, timedelta
ts = 1735689600
# UTC
dt_utc = datetime.fromtimestamp(ts, tz=timezone.utc)
print(dt_utc.isoformat())
# → 2025-01-01T00:00:00+00:00
# With zoneinfo (Python 3.9+)
from zoneinfo import ZoneInfo
dt_paris = datetime.fromtimestamp(ts, tz=ZoneInfo("Europe/Paris"))
print(dt_paris.strftime("%A %d %B %Y %H:%M:%S %Z"))
# → Wednesday 01 January 2025 01:00:00 CET
# Custom format
print(dt_utc.strftime("%Y-%m-%d %H:%M:%S"))
# → 2025-01-01 00:00:00
PHP
PHP 8$ts = 1735689600;
// Simple: gmdate for UTC, date for server local time
echo gmdate('Y-m-d H:i:s', $ts); // 2025-01-01 00:00:00 UTC
echo date('Y-m-d H:i:s', $ts); // server timezone
// With DateTimeImmutable and specific timezone
$dt = (new DateTimeImmutable())->setTimestamp($ts)->setTimezone(new DateTimeZone('America/New_York'));
echo $dt->format('l, F j, Y g:i A');
// → Tuesday, December 31, 2024 7:00 PM
SQL (PostgreSQL & MySQL)
PostgreSQL-- Seconds timestamp to timestamptz
SELECT to_timestamp(1735689600) AT TIME ZONE 'Europe/Paris';
-- → 2025-01-01 01:00:00
-- Format it
SELECT to_char(to_timestamp(1735689600), 'YYYY-MM-DD HH24:MI:SS TZ');
-- → 2025-01-01 00:00:00 UTC
MySQL
SELECT FROM_UNIXTIME(1735689600);
-- → 2025-01-01 00:00:00 (server timezone)
SELECT CONVERT_TZ(FROM_UNIXTIME(1735689600), '+00:00', 'America/New_York');
-- → 2024-12-31 19:00:00
Go
Gopackage main
import (
"fmt"
"time"
)
func main() {
ts := int64(1735689600)
t := time.Unix(ts, 0).UTC()
fmt.Println(t.Format(time.RFC3339)) // 2025-01-01T00:00:00Z
fmt.Println(t.Format("2006-01-02 15:04:05")) // 2025-01-01 00:00:00
loc, _ := time.LoadLocation("America/New_York")
tNY := t.In(loc)
fmt.Println(tNY.Format(time.RFC1123Z)) // Tue, 31 Dec 2024 19:00:00 -0500
}
Common mistakes to avoid
- Passing seconds to a milliseconds API. In JavaScript,
new Date(1735689600)gives January 21, 1970 — not 2025. Always multiply by 1000. - Ignoring timezone.
date()in PHP anddatetime.fromtimestamp()in Python without atzargument both use the server's local timezone, which may differ from the user's. - Storing dates as strings in databases. Store as an integer or a native timestamp type and format for display in the application layer.
- Confusing local time input with UTC. When building a timestamp from a form input, ensure you account for the user's timezone offset before converting.
Need to check a specific timestamp right now? Use the Flowfiles converter — paste the integer and get ISO 8601, RFC 2822, relative time and timezone-aware output instantly.