How to Convert Unix Timestamps to Human-Readable Dates
A Unix timestamp is the number of seconds (or milliseconds) since January 1, 1970 00:00:00 UTC โ called the Unix epoch. APIs, databases, and log files use timestamps because they're unambiguous (no timezone confusion), compact (a single number), and easy to compare mathematically. Converting them to human-readable dates is something developers do daily.
- Convert Unix timestamps to dates and dates to timestamps.
- Covers seconds vs milliseconds.
- Covers converting in javascript.
- Covers timezone handling.
- Covers quick reference.
Seconds vs Milliseconds
Unix timestamps come in two common formats: seconds since epoch (10 digits, like 1713168000) and milliseconds since epoch (13 digits, like 1713168000000). JavaScript's Date.now() returns milliseconds. Most Unix tools and APIs use seconds. The difference matters โ if you pass milliseconds to a function expecting seconds, you'll get a date in the year 56000. Check the digit count: 10 digits = seconds, 13 digits = milliseconds.
Converting in JavaScript
Seconds to date:
new Date(1713168000 * 1000).toISOString();
// '2024-04-15T08:00:00.000Z'
Date to seconds:
Math.floor(Date.now() / 1000);
// current timestamp in seconds
For formatted output: new Date(ts * 1000).toLocaleString('en-US', {timeZone: 'America/New_York'}) returns a locale-formatted string in a specific timezone.
Timezone Handling
Unix timestamps are always UTC โ they represent a single moment in time regardless of timezone. The timezone only matters when displaying the date to a user. Always store and transmit timestamps in UTC (seconds since epoch). Convert to local time only at the display layer. The Timestamp Converter tool shows the converted date in both UTC and your local timezone, making it easy to verify API timestamps and debug timezone issues.
background-size animation or @property registered custom properties instead.Quick Reference
January 1, 2020 00:00:00 UTC = 1577836800. January 1, 2025 00:00:00 UTC = 1735689600. January 1, 2030 00:00:00 UTC = 1893456000. The 'Year 2038 problem' affects systems that store timestamps as 32-bit signed integers โ they overflow on January 19, 2038 at 03:14:07 UTC. Most modern systems use 64-bit timestamps.
Frequently Asked Questions
What is a Unix timestamp?
How do I convert a Unix timestamp to a date?
Why do some timestamps have 10 digits and others have 13?
Use the Timestamp Converter โ free, no signup required.
โก Open Timestamp Converter