Published: May 26, 2026
A Unix timestamp (also called epoch time or POSIX time) is a simple integer: the number of seconds that have elapsed since January 1, 1970 at 00:00:00 UTC, excluding leap seconds. This single moment in time is known as the Unix epoch.
For example, the timestamp 1748246400 represents a specific point in time. To figure out what date that is, you count 1,748,246,400 seconds forward from midnight on January 1, 1970. If you need to convert between timestamps and dates quickly, use our free epoch converter online.
The Unix epoch was chosen in the early 1970s when the Unix operating system was being developed at Bell Labs. January 1, 1970 was simply the date that seemed most convenient at the time — it was close to when the system was being built and made calculations easy. Other systems use different epochs: Windows uses January 1, 1601, and macOS uses January 1, 1904 for certain file system timestamps. But Unix time became the dominant standard across most programming environments.
Here is how to get the current Unix timestamp in major programming languages:
JavaScript:
// Seconds (floor division by 1000) Math.floor(Date.now() / 1000) // Output: 1748246400 // Milliseconds (raw value) Date.now() // Output: 1748246400000
Python:
import time current_timestamp = int(time.time()) print(current_timestamp) # Output: 1748246400
PHP:
$current_timestamp = time(); echo $current_timestamp; // Output: 1748246400
SQL (MySQL/PostgreSQL):
-- MySQL SELECT UNIX_TIMESTAMP(); -- PostgreSQL SELECT EXTRACT(EPOCH FROM NOW())::INT;
Going from a timestamp back to a human-readable date is just as simple.
JavaScript:
const timestamp = 1748246400;
const date = new Date(timestamp * 1000);
console.log(date.toISOString());
// Output: "2026-05-26T10:00:00.000Z"
// Formatted for local timezone
console.log(date.toLocaleDateString('en-US'));
// Output: "5/26/2026"
Python:
from datetime import datetime
timestamp = 1748246400
dt = datetime.utcfromtimestamp(timestamp)
print(dt.strftime('%Y-%m-%d %H:%M:%S'))
# Output: 2026-05-26 10:00:00
# Convert to local time
local_dt = datetime.fromtimestamp(timestamp)
print(local_dt.strftime('%Y-%m-%d %H:%M:%S'))
# Output depends on your timezone
PHP:
$timestamp = 1748246400;
echo date('Y-m-d H:i:s', $timestamp);
// Output: 2026-05-26 10:00:00
echo date('Y-m-d H:i:s T', $timestamp);
// Output: 2026-05-26 10:00:00 UTC
SQL (MySQL):
SELECT FROM_UNIXTIME(1748246400); -- Output: 2026-05-26 10:00:00 SELECT FROM_UNIXTIME(1748246400, '%Y-%m-%d'); -- Output: 2026-05-26
One of the most frequent timestamp bugs is mixing up seconds and milliseconds:
1748246400). Used by Python, PHP, MySQL, and most databases.1748246400000). Used by JavaScript Date.now() and many frontend APIs.Treating milliseconds as seconds (or vice versa) will give you a date that is off by a factor of 1,000 — roughly 1.9 years in the past or future. Always check the unit your source uses. If you see a 13-digit number, divide by 1000 to get the true Unix timestamp.
Unix timestamps are always in UTC. They represent a fixed moment in time, independent of timezone. A timestamp of 1748246400 means the same moment everywhere on Earth — it is 10:00 AM in London, 5:00 AM in New York, and 7:00 PM in Tokyo.
The best practice is to store timestamps in UTC and only convert to local time when displaying to users. This avoids confusion when users in different timezones access the same data. When you use our epoch converter, you can choose between UTC and your local timezone for display.
The classic 32-bit signed integer can hold values up to 2,147,483,647. On January 19, 2038 at 03:14:07 UTC, the Unix timestamp will reach that limit. One second later, the integer overflows and becomes negative, suddenly representing dates in 1901.
This is known as the Year 2038 problem (or Y2K38). It is the Unix equivalent of the Y2K bug. The good news: most modern systems already use 64-bit integers or 64-bit time types (time64_t), which are safe for billions of years. If you are working with legacy embedded systems, IoT devices, or old 32-bit databases, check whether they have been updated.
Unix timestamps are a fundamental concept every developer should understand. Remember: seconds since January 1, 1970 UTC, watch out for the milliseconds pitfall, store in UTC, and be aware of the 2038 problem on legacy systems. When in doubt, use an online converter to double-check your values.