Unix Timestamp & Epoch Time: The Complete Developer's Guide
Quick answer: Right now, the Unix timestamp is approximately 1736640000. That's the number of seconds since January 1, 1970 at 00:00:00 UTCβknown as the Unix epoch.
If you've ever debugged timestamp issues in production, dealt with timezone bugs, or wondered why dates break when moving between systems, this guide will save you hours of frustration.
What is Unix Time (Epoch Time)?
Unix time is a system for tracking time as a single number: the count of seconds since the Unix epoch (January 1, 1970, 00:00:00 UTC).
Why January 1, 1970?
This date was chosen when Unix was developed at Bell Labs. It needed a reference point, and 1970 was recent, round, and memorable. That's itβno grand cosmic significance, just pragmatic engineering.
Example Conversion
Unix Timestamp: 1736640000
Human Date: January 12, 2026 00:00:00 UTC
Unix Timestamp: 0
Human Date: January 1, 1970 00:00:00 UTC (the epoch!)
Unix Timestamp: 946684800
Human Date: January 1, 2000 00:00:00 UTC (Y2K)
Seconds vs Milliseconds
This trips up developers constantly:
- Unix timestamp (seconds): 1736640000 (10 digits)
- JavaScript timestamp (milliseconds): 1736640000000 (13 digits)
// JavaScript Date.now() returns milliseconds
const jsTimestamp = Date.now(); // 1736640000000
const unixTimestamp = Math.floor(Date.now() / 1000); // 1736640000
// Converting between them
const unixToJs = unixTimestamp * 1000;
const jsToUnix = Math.floor(jsTimestamp / 1000);
Pro Tip: If your timestamp has 13 digits, it's milliseconds. If it has 10 digits, it's seconds.
Why Use Unix Timestamps?
1. Timezone Independence
Unix timestamps are always UTC. No more "Is this 5pm EST or PST?" confusion:
// Stored in database
timestamp: 1736640000 (UTC)
// Displayed to user in New York
new Date(1736640000 * 1000).toLocaleString('en-US', {
timeZone: 'America/New_York'
});
// "1/11/2026, 7:00:00 PM"
// Displayed to user in Tokyo
new Date(1736640000 * 1000).toLocaleString('en-US', {
timeZone: 'Asia/Tokyo'
});
// "1/12/2026, 9:00:00 AM"
2. Easy Date Math
// Add 1 day (86400 seconds)
const tomorrow = currentTimestamp + 86400;
// Check if event is in the past
const isPast = eventTimestamp < Math.floor(Date.now() / 1000);
// Calculate age
const ageInSeconds = currentTimestamp - birthTimestamp;
const ageInYears = Math.floor(ageInSeconds / 31536000);
3. Universal Compatibility
Every programming language understands Unix timestamps:
// Python
import time
timestamp = int(time.time())
// PHP
$timestamp = time();
// Go
timestamp := time.Now().Unix()
// Ruby
timestamp = Time.now.to_i
// Java
long timestamp = System.currentTimeMillis() / 1000;
π Convert Timestamps Instantly
Use our free Unix Timestamp Converter to convert between epoch time and human-readable dates, handle timezones, and debug date issues.
Open Timestamp Tool βCommon Unix Timestamp Pitfalls
Pitfall #1: Mixing Seconds and Milliseconds
// JavaScript expects milliseconds
new Date(1736640000); // β January 21, 1970 (WAY too early)
new Date(1736640000 * 1000); // β
January 12, 2026
// Python's time.time() returns seconds
import datetime
datetime.datetime.fromtimestamp(1736640000) // β
Correct
Pitfall #2: Forgetting UTC
// WRONG: Creates date in local timezone
const date = new Date(2026, 0, 12); // Midnight in YOUR timezone
// RIGHT: Creates date in UTC
const date = new Date(Date.UTC(2026, 0, 12)); // Midnight UTC
Pitfall #3: The Year 2038 Problem
32-bit signed integers can only hold timestamps up to 2147483647 (January 19, 2038, 03:14:07 UTC). After that, they overflow.
Solution: Use 64-bit integers. Most modern systems already do this, but legacy code may still have issues.
Timezone Conversion Examples
JavaScript (Browser)
const timestamp = 1736640000;
const date = new Date(timestamp * 1000);
// User's local timezone
console.log(date.toLocaleString());
// Specific timezone
console.log(date.toLocaleString('en-US', {
timeZone: 'America/Los_Angeles',
dateStyle: 'full',
timeStyle: 'long'
}));
Python
import datetime
import pytz
timestamp = 1736640000
utc_time = datetime.datetime.utcfromtimestamp(timestamp)
# Convert to specific timezone
ny_tz = pytz.timezone('America/New_York')
ny_time = utc_time.replace(tzinfo=pytz.utc).astimezone(ny_tz)
print(ny_time.strftime('%Y-%m-%d %H:%M:%S %Z'))
PHP
$timestamp = 1736640000;
$date = new DateTime("@$timestamp");
// Set timezone
$date->setTimezone(new DateTimeZone('Europe/London'));
echo $date->format('Y-m-d H:i:s T');
Useful Timestamp Formulas
// Seconds in common time periods
1 minute = 60 seconds
1 hour = 3,600 seconds
1 day = 86,400 seconds
1 week = 604,800 seconds
1 year = 31,536,000 seconds (365 days)
// Current timestamp
Now = Math.floor(Date.now() / 1000)
// Midnight today (UTC)
Midnight = Math.floor(Date.now() / 1000 / 86400) * 86400
// Start of current month
const now = new Date();
const monthStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1));
const timestamp = Math.floor(monthStart.getTime() / 1000);
Database Storage
SQL (Best Practices)
-- Store as INTEGER (Unix timestamp in seconds)
CREATE TABLE events (
id SERIAL PRIMARY KEY,
name TEXT,
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
);
-- Or use native TIMESTAMP (stores internally as Unix time)
CREATE TABLE events (
id SERIAL PRIMARY KEY,
name TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Query with conversion
SELECT
name,
datetime(created_at, 'unixepoch') as human_date
FROM events
WHERE created_at > strftime('%s', '2026-01-01');
MongoDB
// MongoDB stores dates as milliseconds since epoch
{
name: "Event",
createdAt: new Date() // Stores internally as ISODate()
}
// Query
db.events.find({
createdAt: { $gt: new Date('2026-01-01') }
});
API Best Practices
JSON API Response
{
"user": {
"id": 123,
"name": "John Doe",
"created_at": 1736640000, // Unix timestamp (seconds)
"last_login": "2026-01-12T00:00:00Z" // ISO 8601 (alternative)
}
}
Recommendation: Use Unix timestamps for internal APIs where both sides are under your control. Use ISO 8601 for public APIs consumed by third parties (more human-readable).
Special Timestamps to Remember
0 = January 1, 1970 00:00:00 UTC (The Unix Epoch)
946684800 = January 1, 2000 00:00:00 UTC (Y2K)
1000000000 = September 9, 2001 01:46:40 UTC
1234567890 = February 13, 2009 23:31:30 UTC
1500000000 = July 14, 2017 02:40:00 UTC
2147483647 = January 19, 2038 03:14:07 UTC (32-bit overflow!)
Debugging Tips
Is This Timestamp Valid?
// Quick sanity check
function isValidTimestamp(ts) {
const date = new Date(ts * 1000);
// Should be between 1970 and 2100
return date.getFullYear() >= 1970 && date.getFullYear() < 2100;
}
isValidTimestamp(1736640000); // true
isValidTimestamp(999999999999); // false (year 33658!)
Debugging Timezone Issues
const timestamp = 1736640000;
const date = new Date(timestamp * 1000);
console.log('UTC:', date.toUTCString());
console.log('ISO:', date.toISOString());
console.log('Local:', date.toLocaleString());
console.log('Timezone Offset:', date.getTimezoneOffset(), 'minutes');
console.log('Unix Timestamp:', Math.floor(date.getTime() / 1000));
Conclusion: Timestamps Done Right
Unix timestamps are the foundation of time handling in modern software. Remember:
- β Always store dates as UTC (Unix timestamps or UTC datetime)
- β Convert to local timezone only for display
- β Use 10 digits for seconds, 13 for milliseconds
- β Be aware of the 2038 problem for legacy 32-bit systems
- β Never store dates in local timezone
- β Don't mix seconds and milliseconds
π All Developer Tools in One Place
Timestamp conversion, Base64 encoding, JWT debugging, hash generation, and more. All tools run locallyβyour data never leaves your browser.
Explore Tools β