Timestamp Converter
Convert Unix timestamps to human-readable dates and vice versa.
What is a Unix Timestamp and how does it work?
A Unix timestamp (also called Unix epoch time or POSIX time) is a number that represents the amount of seconds elapsed since January 1, 1970 at 00:00:00 UTC, known as the "Unix epoch". This system was adopted by Unix and subsequently by most programming languages and operating systems as a standard way to represent dates and times.
The main advantage of Unix timestamps is that they are independent of time zones and regional date formats. A timestamp represents the same exact instant regardless of whether you're in Madrid, Tokyo, or New York. Conversion to a human-readable date is done by applying the user's local time zone.
Practical use cases
Databases: Storing dates as integer timestamps is more efficient than using strings and makes comparisons and sorting easier. MySQL, PostgreSQL, and MongoDB support timestamps natively.
REST APIs: Most APIs return dates in Unix timestamp format (in seconds or milliseconds). Converting them to readable dates is essential for displaying information to users.
Logs and debugging: Server logs frequently use Unix timestamps. Converting them allows you to correlate events across different systems and time zones.
Cache and expiration: HTTP cache headers (Cache-Control, Expires) and JWT tokens use Unix timestamps to indicate expiration dates.
Frequently asked questions
What is the difference between timestamps in seconds and milliseconds?
Unix originally uses seconds (10 digits, e.g.: 1700000000). JavaScript uses milliseconds (13 digits, e.g.: 1700000000000). If your timestamp has 13 digits, divide it by 1000 before converting. Python uses seconds by default.
What is the Year 2038 problem?
32-bit systems store timestamps as 32-bit signed integers, whose maximum value is 2,147,483,647 (January 19, 2038). After that date, the value will overflow. 64-bit systems don't have this problem.
Do timestamps include time zones?
No. A Unix timestamp always represents an absolute instant in UTC. The time zone is only applied when converting it to a human-readable date. That's why they're ideal for distributed systems across multiple time zones.
Can timestamps be negative?
Yes. Negative timestamps represent dates before January 1, 1970. For example, -86400 represents December 31, 1969. Most modern systems support negative timestamps.
Timestamps in different languages
| Language | Get timestamp | Unit |
|---|---|---|
| JavaScript | Date.now() | Milliseconds |
| Python | time.time() | Seconds (float) |
| Java | System.currentTimeMillis() | Milliseconds |
| Go | time.Now().Unix() | Seconds |