Timestamp Converter
Free online tool to convert Unix timestamp to date and date to Unix timestamp.
What is Unix Timestamp?
Unix timestamp (or Epoch time) is a number representing seconds elapsed since January 1, 1970 00:00:00 UTC. It's the standard way to represent date and time in computer systems.
Key Features
- Bidirectional Conversion: Timestamp → Date, Date → Timestamp
- Real-time Current Time: Auto-updates every second
- Use Current Time: Input current time with one click
- Instant Copy: Copy each value to clipboard
- Auto-detect Format: Automatically detect seconds/milliseconds
How to Use
Timestamp → Date Conversion
- Select "Timestamp → Date" mode
- Enter Unix timestamp (e.g., 1640995200)
- Click "Convert" button
- Date/time is displayed
Date → Timestamp Conversion
- Select "Date → Timestamp" mode
- Select date/time
- Click "Convert" button
- Unix timestamp is displayed
Use Current Time
- Click "Use Current Time" button to automatically input current time
Unix Timestamp Formats
Seconds - Standard
1640995200
- 10-digit number
- Most common format
- After September 9, 2001, always 10 digits
Milliseconds
1640995200000
- 13-digit number
- Mainly used in JavaScript
- More precise time representation
This tool automatically detects and converts!
Timestamp Examples
Key Dates
Unix Epoch (Starting Point)
Timestamp: 0
Date: 1970-01-01 00:00:00
Y2K (2000)
Timestamp: 946684800
Date: 2000-01-01 00:00:00
Start of 2020
Timestamp: 1577836800
Date: 2020-01-01 00:00:00
Start of 2025
Timestamp: 1735689600
Date: 2025-01-01 00:00:00
2038 Problem (32-bit max value)
Timestamp: 2147483647
Date: 2038-01-19 03:14:07
Use Cases
1. API Response Debugging
{
"created_at": 1640995200,
"updated_at": 1640995260
}
Convert timestamps to readable dates!
2. Log Analysis
[1640995200] User login successful
[1640995260] User logout
Check actual dates from log timestamps!
3. Database Query
SELECT * FROM orders
WHERE created_at > 1640995200;
Query data after specific time!
4. Cookie Expiry Time
const expiryTimestamp = Math.floor(Date.now() / 1000) + (7 * 24 * 60 * 60);
// Expires in 7 days
5. Cache Validation
const cacheExpiry = 1640995200;
const now = Math.floor(Date.now() / 1000);
if (now > cacheExpiry) {
// Cache expired
}
Programming Language Usage
JavaScript
// Current timestamp (milliseconds)
const timestampMs = Date.now();
// Current timestamp (seconds)
const timestamp = Math.floor(Date.now() / 1000);
// Timestamp → Date
const date = new Date(1640995200 * 1000);
// Date → Timestamp
const ts = Math.floor(new Date('2022-01-01').getTime() / 1000);
Python
import time
from datetime import datetime
# Current timestamp
timestamp = int(time.time())
# Timestamp → Date
date = datetime.fromtimestamp(1640995200)
print(date) # 2022-01-01 00:00:00
# Date → Timestamp
dt = datetime(2022, 1, 1)
timestamp = int(dt.timestamp())
PHP
<?php
// Current timestamp
$timestamp = time();
// Timestamp → Date
$date = date('Y-m-d H:i:s', 1640995200);
// Date → Timestamp
$timestamp = strtotime('2022-01-01');
?>
Java
import java.time.*;
// Current timestamp
long timestamp = Instant.now().getEpochSecond();
// Timestamp → Date
Instant instant = Instant.ofEpochSecond(1640995200L);
LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.of("UTC"));
// Date → Timestamp
LocalDateTime dt = LocalDateTime.of(2022, 1, 1, 0, 0);
long ts = dt.atZone(ZoneId.of("UTC")).toEpochSecond();
SQL
-- MySQL: Timestamp → Date
SELECT FROM_UNIXTIME(1640995200);
-- MySQL: Date → Timestamp
SELECT UNIX_TIMESTAMP('2022-01-01 00:00:00');
-- PostgreSQL: Timestamp → Date
SELECT to_timestamp(1640995200);
-- PostgreSQL: Date → Timestamp
SELECT extract(epoch from timestamp '2022-01-01 00:00:00');
Timezone Considerations
Unix timestamps are always UTC-based!
Korean Time (KST = UTC+9)
UTC: 2022-01-01 00:00:00 (Timestamp: 1640995200)
KST: 2022-01-01 09:00:00
Conversion Caution
// Wrong - uses local timezone
const wrong = new Date('2022-01-01'); // Local timezone
// Correct - specify UTC
const correct = new Date('2022-01-01T00:00:00Z'); // Z = UTC
Year 2038 Problem
Maximum Unix timestamp value on 32-bit systems:
2147483647 = 2038-01-19 03:14:07 UTC
Times after this cannot be represented (overflow).
Solution
- Use 64-bit Systems: Can represent up to 292 billion years
- Most Modern Systems: Already using 64-bit
Practical Tips
1. Calculate Time Difference
const start = 1640995200;
const end = 1641000000;
const diffSeconds = end - start; // 4800 seconds
const diffMinutes = diffSeconds / 60; // 80 minutes
const diffHours = diffMinutes / 60; // 1.33 hours
2. Calculate Future/Past Time
const now = Math.floor(Date.now() / 1000);
// 1 hour later
const oneHourLater = now + (60 * 60);
// 7 days ago
const sevenDaysAgo = now - (7 * 24 * 60 * 60);
3. Date Comparison
const timestamp1 = 1640995200;
const timestamp2 = 1641000000;
if (timestamp1 < timestamp2) {
console.log('timestamp1 is earlier');
}
4. Check Expiry Time
const expiryTimestamp = 1640995200;
const now = Math.floor(Date.now() / 1000);
if (now > expiryTimestamp) {
console.log('Expired');
} else {
const remainingSeconds = expiryTimestamp - now;
console.log(`${remainingSeconds} seconds remaining`);
}
Frequently Asked Questions
Q: Why does Unix timestamp start from January 1, 1970?
1970 is when the Unix operating system was first developed. This date was chosen as the "Epoch" (origin).
Q: Are negative timestamps possible?
Yes! Negative values represent times before 1970.
-86400 = 1969-12-31 00:00:00
Q: Should I use seconds or milliseconds?
- Seconds (10 digits): Most backend systems, Unix/Linux
- Milliseconds (13 digits): JavaScript, when more precision is needed
Q: Can I determine timezone from timestamp?
No. Unix timestamps are always UTC-based. Timezone information is not included.
Q: Which is better, timestamp or ISO 8601?
- Timestamp: Easier to calculate (number), less storage
- ISO 8601: Human-readable (e.g., 2022-01-01T00:00:00Z)
Choose based on your situation!
🔗 Try These Next
- UUID Generator - Generate unique identifiers
- Hash Generator - Hash timestamps
Performance
- Conversion Speed: Sub-millisecond
- Real-time Update: 1-second interval
- Memory Usage: Minimal
- Offline Operation: Fully supported
Browser Compatibility
This tool works in all modern browsers:
- Chrome (all versions) ✓
- Firefox (all versions) ✓
- Safari (all versions) ✓
- Edge (all versions) ✓
💬 Was this tool helpful?
Feel free to send us your feedback or suggestions anytime!
Privacy
This tool operates entirely on the client side. Your input data is never sent to a server and is processed only in your browser.