Epoch/Unix Timestamp Converter
Current Time
Local Time
Loading...
Unix Timestamp (seconds)
0
Unix Timestamp (milliseconds)
0
Date/Time to Unix Timestamp
Unix Timestamp (seconds)
0
Unix Timestamp (milliseconds)
0
Unix Timestamp to Date/Time
Converted Date/Time
Enter a timestamp to convert
Date
--
Time
--
About Epoch/Unix Timestamps
The Unix epoch is 00:00:00 UTC on January 1, 1970. Epoch time counts the number of seconds (or milliseconds) that have elapsed since this reference point. This system is widely used in computing because it provides a standardized way to represent time across different systems and programming languages.
Getting Current Epoch Time
JavaScript/Node.js
Math.floor(Date.now() / 1000) // seconds
Date.now() // milliseconds
Python
import time
int(time.time()) # seconds
int(time.time() * 1000) # milliseconds
Java
// Java 8+<br/>
Instant.now().getEpochSecond() // seconds<br/>
System.currentTimeMillis() // milliseconds
C#
DateTimeOffset.Now.ToUnixTimeSeconds() // seconds<br/>
DateTimeOffset.Now.ToUnixTimeMilliseconds() // milliseconds
Converting Date to Epoch
PHP
strtotime("2023-01-15 12:00:00") // seconds<br/>
$date = new DateTime("2023-01-15 12:00:00");<br/>
$date->format(‘U‘) * 1000 // milliseconds
SQL (MySQL)
SELECT UNIX_TIMESTAMP(‘2023-01-15 12:00:00‘);
SELECT UNIX_TIMESTAMP(‘2023-01-15 12:00:00‘) * 1000;
Go
t, _ := time.Parse(“2006-01-02 15:04:05“,“2023-01-15 12:00:00“)<br/>
t.Unix() // seconds<br/>
t.UnixMilli() // milliseconds
Shell
date -d“2023-01-15 12:00:00“+%s # seconds
date -d“2023-01-15 12:00:00“+%s%3N # milliseconds
Converting Epoch to Date
JavaScript
// Seconds to Date<br/>
new Date(1673784000 * 1000).toISOString()<br/><br/>
// Milliseconds to Date<br/>
new Date(1673784000000).toISOString()
Python
from datetime import datetime
datetime.fromtimestamp(1673784000) # seconds
datetime.fromtimestamp(1673784000000 / 1000) # milliseconds
C++
#include <chrono>
#include <ctime>
std::time_t time = 1673784000;
std::tm *tm = std::localtime(&time);
PowerShell
[datetimeoffset]::
FromUnixTimeSeconds(1673784000)
FromUnixTimeMilliseconds(1673784000000)
Why Use Epoch Time?
- Standardized time representation across different systems and timezones
- Easier for calculations and comparisons than human-readable dates
- Compact storage format in databases and APIs
- Essential for logging, caching, and scheduling systems
Common Use Cases
- API responses and request timestamps
- Database record timestamps
- Log file entries
- Cache expiration headers
- Session timeouts
- Performance measurement
Related terms: Unix timestamp converter, epoch time calculator, seconds since epoch, milliseconds since epoch, date to timestamp, timestamp to date, programming time functions, time conversion across languages, UTC time conversion, timezone-aware timestamps.