Epoch & Unix Timestamp Conversion Tools

 

The current Unix epoch time is 
1772740460

 

Convert epoch to human-readable date and vice versa

Supports Unix timestamps in seconds, milliseconds, microseconds and nanoseconds.
MonDayYr
// 
HrMinSec
 :  :  
 

 

Input format: RFC 2822, D-M-Y, M/D/Y, Y-M-D, etc. Strip 'GMT' to convert to local time.
 


Press c to clear all forms.

Epoch dates for the start and end of the year/month/day

Show start & end of

MonDayYr
/ /    
 
 [list months & years]


Convert seconds to years, months, days, hours and minutes

 

What is epoch time?

The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking, the epoch is Unix time 0 (midnight 1/1/1970), but 'epoch' is often used as a synonym for Unix time. Some systems store epoch dates as a signed 32-bit integer, which might cause problems on January 19, 2038 (known as the Year 2038 problem or Y2038). The converter on this page converts timestamps in seconds (10-digit), milliseconds (13-digit) and microseconds (16-digit) to readable dates.

Human-readable time Seconds
1 hour3600 seconds
1 day86400 seconds
1 week604800 seconds
1 month (30.44 days) 2629743 seconds
1 year (365.25 days)  31556926 seconds

Code examples

How to get the current epoch time in code...

The first line for each language shows how to get the current epoch time. The second line shows how to convert an epoch timestamp to a human-readable date. Replace the example epoch time 1800000000 with your own value. All examples return the epoch timestamp in seconds (and not milliseconds).

The full list in the programming section also includes examples for converting human-readable dates to epoch time.

Pythonimport time; time.time()
import time; time.ctime(1800000000)
PHPtime()
date('r', 1800000000); More PHP
JavaScriptMath.floor(new Date().getTime()/1000.0)
new Date(1800000000*1000).toLocaleString() or toUTCString(). More JavaScript
Javalong epoch = System.currentTimeMillis()/1000;
String date = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new java.util.Date (1800000000*1000));
CUse the C Epoch Converter routines
C++double now = std::chrono::duration_cast<std::chrono::seconds> (std::chrono::system_clock::now().time_since_epoch()).count();
C#DateTimeOffset.Now.ToUnixTimeSeconds()
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(epoch).ToShortDateString();
Perltime
scalar localtime(1800000000); More Perl
RubyTime.now.to_i
Time.at(1800000000)
Gotime.Now().Unix()
time.Unix(1800000000, 0) More Go
Ras.numeric(Sys.time())
as.POSIXct(1800000000, origin="1970-01-01", tz="GMT")
Luaepoch = os.time([date])
datestring = os.date([format[,epoch]])
DartDateTime.now().millisecondsSinceEpoch ~/ 1000
DateTime.fromMillisecondsSinceEpoch(1800000000*1000)
DelphiEpoch := DateTimeToUnix(Now, False);
myString := DateTimeToStr(UnixToDateTime(Epoch));
PostgreSQLSELECT EXTRACT(EPOCH FROM now());
SELECT TO_TIMESTAMP(1800000000);
MySQLSELECT UNIX_TIMESTAMP(NOW());
SELECT FROM_UNIXTIME(1800000000); More MySQL
SQL ServerSELECT DATEDIFF(SECOND, '1970-01-01', GETUTCDATE());
SELECT DATEADD(SECOND, 1800000000, '1970-01-01');
SQLiteSELECT unixepoch();
SELECT datetime(1800000000, 'unixepoch');
or local time zone: SELECT datetime(1800000000, 'unixepoch', 'localtime');
Unix/Linux Shelldate +%s
date -d @1800000000 Replace '-d' with '-ud' for UTC time.
macOSdate +%s
date -j -r 1800000000
PowerShell[DateTimeOffset]::Now.ToUnixTimeSeconds()
[DateTimeOffset]::FromUnixTimeSeconds(1800000000).LocalDateTime
Excel/LibreOffice Calc =(A1 / 86400) + 25569 Format the result cell for date/time. The result is in GMT (A1 contains the epoch). For other time zones: =((A1 +/- time zone adjustment) / 86400) + 25569.
 
Find more examples on the programming page.
 

Thanks to everyone who sent me corrections and updates!

More date-related programming examples: What's the current week number? - What's the current day number?

Please note: All tools on this page are based on the date & time settings of your computer and use JavaScript to convert times. Some browsers use the current DST (Daylight Saving Time) rules for all dates in history. JavaScript does not support leap seconds.