Epoch Converter
Convert between Unix timestamps and human-readable dates
The current Unix epoch time is
0
Formats: RFC 2822, ISO 8601, MM/DD/YYYY, DD-MM-YYYY, etc.
What is Unix Epoch Time?
The Unix epoch is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds.
Seconds vs Milliseconds - The #1 Issue
Different systems use different units, leading to dates in year 1970 or 50,000+
Seconds (10 digits)
1766408172
Used by: Unix/Linux, Python, PHP, Ruby
Milliseconds (13 digits)
1766408172000
Used by: JavaScript, Java, .NET
💡 Pro Tip:
Count the digits! 10 = seconds, 13 = milliseconds, 16 = microseconds, 19 = nanoseconds
UTC vs Local Time
Timestamps are always UTC, but displaying requires timezone conversion
// ❌ Wrong - assumes server timezone
const date = new Date("2025-12-22 14:30:00")
// ✅ Better - explicit timezone
const date = new Date("2025-12-22T14:30:00Z") // UTC
const date = new Date("2025-12-22T14:30:00-05:00") // EST
Database Storage Best Practices
Choosing the right data type is crucial
INT (32-bit)
❌ Limited to 2038, avoid for new systems
BIGINT (64-bit)
✅ Recommended - supports milliseconds & beyond 2038
DATETIME / TIMESTAMP
⚠️ Timezone handling varies by database
✅ Recommendation:
Store as BIGINT (milliseconds since epoch) for maximum flexibility and compatibility
Date String Formats
Different systems use different date string formats
💡 Always use ISO 8601 for data exchange and storage
The Year 2038 Problem
32-bit signed integers overflow on January 19, 2038 at 03:14:07 UTC
Solution: Use 64-bit integers (BIGINT in SQL, long in Java)
Negative Timestamps (Before 1970)
Dates before January 1, 1970 have negative timestamps
December 31, 1969
-86400
January 1, 1960
-315619200
⚠️ Not all systems handle negative timestamps correctly
Leap Seconds
Unix timestamps ignore leap seconds for simplicity
Real-world time occasionally adds a leap second to keep atomic clocks in sync with Earth's rotation. Unix time ignores these adjustments, which can cause sub-second timing issues in precise applications.
Examples: GPS systems, financial trading, scientific measurements