Epoch & Unix Timestamp Conversion Tools

 

The current Unix epoch time is 
1772835096

 

Convert epoch to human-readable date and vice versa

Preferences
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.
 

Also see our dynamic list of dates (1 day ago, next week, etc.)
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 (also called Unix time, POSIX time, or a Unix timestamp) is the number of seconds since January 1, 1970, 00:00:00 UTC, not counting leap seconds (ISO 8601: 1970-01-01T00:00:00Z). Strictly speaking, the epoch is Unix time 0, but people often use "epoch" as shorthand for Unix time in general. Some systems store epoch values as signed 32-bit integers, which can break on January 19, 2038, in the Year 2038 Problem. This page converts timestamps in seconds (10 digits), milliseconds (13 digits), and microseconds (16 digits) into 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.