Unix Timestamp Converter
Convert Unix Timestamp to Human-Readable Date
Convert Human-Readable Date to Unix Timestamp
Current Unix Timestamp
1732467266
This value updates every second.
What is a Unix Timestamp?
A Unix timestamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC. Therefore, the Unix timestamp is merely the number of seconds between a particular date and the Unix Epoch.
Key Points About Unix Timestamps:
- Unix timestamps are typically expressed in UTC (Coordinated Universal Time).
- They are independent of time zones.
- Unix timestamps can be negative for dates before the Unix Epoch.
- They are widely used in programming and databases for storing date and time information.
Advantages of Unix Timestamps:
- Compact representation of date and time.
- Easy to perform date/time arithmetic.
- Unambiguous and timezone-independent.
Limitations:
- 32-bit systems may experience the "Year 2038 problem" due to integer overflow.
- Not human-readable without conversion.
Common Unix Timestamp Values
Date & Time | Unix Timestamp |
---|---|
January 1, 1970 00:00:00 GMT (Unix Epoch) | 0 |
February 13, 2009 23:31:30 GMT (Bitcoin Genesis Block) | 1234567890 |
March 18, 2033 03:33:20 GMT | 2000000000 |
January 19, 2038 03:14:07 GMT (32-bit overflow) | 2147483647 |
Using Unix Timestamps in Programming
Unix timestamps are widely used in programming for date and time operations. Here are some examples of how to work with Unix timestamps in popular programming languages:
PHP:
// Get current Unix timestamp
$timestamp = time();
// Convert Unix timestamp to human-readable date
$date = date('Y-m-d H:i:s', $timestamp);
// Convert human-readable date to Unix timestamp
$timestamp = strtotime('2023-09-12 15:30:00');
JavaScript:
// Get current Unix timestamp (in milliseconds)
const timestamp = Date.now();
// Convert Unix timestamp to human-readable date
const date = new Date(timestamp * 1000);
// Convert human-readable date to Unix timestamp
const timestamp = Math.floor(new Date('2023-09-12T15:30:00').getTime() / 1000);
Python:
import time
from datetime import datetime
# Get current Unix timestamp
timestamp = int(time.time())
# Convert Unix timestamp to human-readable date
date = datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
# Convert human-readable date to Unix timestamp
timestamp = int(datetime.strptime('2023-09-12 15:30:00', '%Y-%m-%d %H:%M:%S').timestamp())