Convert Unix timestamps to readable dates and vice versa
Convert Unix timestamp to date
Convert date to Unix timestamp
Convert between Unix timestamps and human-readable dates
Enter a Unix timestamp (seconds since Jan 1, 1970) and click 'Convert to Date' to see the readable date and time.
Select a date and time using the date picker, then click 'Convert to Timestamp' to get the Unix timestamp.
Click the 'Now' button to quickly set the current timestamp or date.
Click the copy icon to copy the converted value to your clipboard.
Developers often need to generate the current Unix timestamp. Here is how to do it in popular programming languages:
| Language | Code Snippet |
|---|---|
| JavaScript | Math.floor(Date.now() / 1000) |
| Python | import time; int(time.time()) |
| PHP | time() |
| Java | System.currentTimeMillis() / 1000 |
| Go | time.Now().Unix() |
| C# | DateTimeOffset.UtcNow.ToUnixTimeSeconds() |
| Ruby | Time.now.to_i |
| SQL (MySQL) | UNIX_TIMESTAMP() |
A Unix timestamp (also known as Unix Epoch time, POSIX time, or Unix time) is a system for describing a point in time. It is defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, minus leap seconds. It is widely used in operating systems and file formats.
The Unix Epoch is the time 00:00:00 UTC on 1 January 1970. It serves as the reference point from which Unix time is measured. Timestamps before this date are negative, and timestamps after are positive. This simple integer representation makes it easy for computers to store, compare, and calculate dates.
Unix time provides a uniform way to track time across different systems and time zones. Since it is just a number (integer), it is unaffected by time zones or daylight saving time adjustments. This makes it perfect for logging events, storing timestamps in databases, and synchronizing data between servers in different parts of the world.
On January 19, 2038, 32-bit signed integers will overflow, meaning they won't be able to store the number of seconds since the Unix Epoch. This is known as the Year 2038 problem (Y2K38). Most modern systems have already migrated to 64-bit integers, which can store dates for billions of years, effectively solving this issue for the foreseeable future.
Working with timestamps in Excel? Here is how to convert them:
Here are quick code snippets to get the current Unix timestamp in popular programming languages:
JavaScript / Node.js
`Math.floor(Date.now() / 1000)`
Python
`import time; time.time()`
PHP
`time()`
Java
`System.currentTimeMillis() / 1000L`
C#
`DateTimeOffset.UtcNow.ToUnixTimeSeconds()`
Go
`time.Now().Unix()`
Ruby
`Time.now.to_i`
Swift
`Int(Date().timeIntervalSince1970)`