What is an epoch time converter?
An epoch time converter is a tool that converts epoch time (also known as Unix time) into human-readable date and time formats, and vice versa. Epoch time represents the number of seconds (or milliseconds) elapsed since January 1, 1970 (UTC).
What day of the year is it?
You can use our epoch time converter to view the current day of the year.
Why is epoch time used?
Epoch time is widely used because it provides a standard way to represent time across different systems, simplifies time calculations like differences or comparisons, and avoids issues related to time zones and date formats.
Is the epoch time converter free?
Yes, our epoch time converter is free to use.
Can the epoch time converter handle leap seconds?
Epoch time does not account for leap seconds. While human-readable time may include leap seconds, Unix time treats them as continuous seconds.
How do I convert epoch time manually?
To manually convert epoch time to a date, divide the epoch time by seconds in a day (86,400) to calculate the day and use a reference calendar. However, using a tool or library is far more efficient and error-free.
Get the Current Epoch Time
Language/Tool | Code Snippet | Notes |
---|---|---|
PHP | time() | |
Python | import time; time.time() | |
Ruby | Time.now or Time.new . To display the epoch: Time.now.to_i | |
Perl | time | |
Java | long epoch = System.currentTimeMillis()/1000; | Returns epoch in seconds. |
C# | DateTimeOffset.Now.ToUnixTimeSeconds() | .NET Framework 4.6+/Core. |
Objective-C | [[NSDate date] timeIntervalSince1970]; | Returns a double . |
C++11 | double now = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count(); | |
Lua | epoch = os.time([date]) | |
VBScript/ASP | See the examples | |
AutoIT | _DateDiff('s', "1970/01/01 00:00:00", _NowCalc()) | |
Delphi | Epoch := DateTimetoUnix(Now); | Tested in Delphi 2010. |
Dart | DateTime.now().microsecondsSinceEpoch | |
R | as.numeric(Sys.time()) | |
Erlang/OTP | erlang:system_time(seconds). | Version 18+. |
MySQL | SELECT unix_timestamp(now()); | |
PostgreSQL | SELECT extract(epoch FROM now()); | |
SQLite | SELECT strftime('%s', 'now'); | |
Oracle PL/SQL | SELECT (CAST(SYS_EXTRACT_UTC(SYSTIMESTAMP) AS DATE) - TO_DATE('01/01/1970','DD/MM/YYYY')) * 24 * 60 * 60 FROM DUAL; | |
SQL Server | SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE()); | |
IBM Informix | SELECT dbinfo('utc_current') FROM sysmaster:sysdual; | |
JavaScript | Math.floor(new Date().getTime()/1000.0); | Returns epoch in seconds. |
Visual FoxPro | DATETIME() - {^1970/01/01 00:00:00} | Time zones not handled correctly. |
Go | time.Now().Unix(); | |
Adobe ColdFusion | <cfset epochTime = left(getTickcount(), 10)>; | |
Tcl/Tk | clock seconds | |
Unix/Linux Shell | date +%s | |
Solaris | /usr/bin/nawk 'BEGIN {print srand()}' | Solaris doesn’t support date +%s . |
PowerShell | [int][double]::Parse((Get-Date (get-date).touniversaltime() -UFormat %s)) |