Epoch Timestamp Converter

Convert Unix timestamps to human-readable dates and vice versa

Current Unix Timestamp:

Timestamp to Date

Date to Timestamp

Epoch Dates

Show start & end of year, month, day

Convert Seconds to Days, Hours and Minutes

How to Get Current Epoch Time

PHP
time()
Python
import time; int(time.time())
Ruby
Time.now.to_i
Perl
time
Java
System.currentTimeMillis() / 1000
C#
DateTimeOffset.Now.ToUnixTimeSeconds()
Objective-C
[[NSDate date] timeIntervalSince1970]
C++11
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count()
Lua
os.time()
VBScript/ASP
DateDiff("s", "01/01/1970 00:00:00", Now())
AutoIT
_DateDiff('s', "1970/01/01 00:00:00", _NowCalc())
Delphi
DateTimeToUnix(Now)
Dart
DateTime.now().millisecondsSinceEpoch ~/ 1000
R
as.integer(Sys.time())
Erlang/OTP
calendar:datetime_to_gregorian_seconds(calendar:universal_time()) - 62167219200
MySQL
SELECT UNIX_TIMESTAMP()
PostgreSQL
SELECT extract(epoch from now())
SQLite
SELECT strftime('%s', 'now')
Oracle PL/SQL
SELECT (SYSDATE - DATE '1970-01-01') * 86400 FROM DUAL
SQL Server
SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())
IBM Informix
SELECT (CURRENT - DATE('1970-01-01')) * 86400 FROM systables WHERE tabid=1
JavaScript
Math.floor(Date.now() / 1000)
Visual FoxPro
(DATETIME() - {^1970-01-01 00:00:00}) * 86400
Go
time.Now().Unix()
Adobe ColdFusion
DateDiff("s", "January 1 1970 00:00", Now())
Tcl/Tk
clock seconds
Unix/Linux Shell
date +%s
Solaris
truss date 2>&1 | awk '/^time\(\)/{print $3}'
PowerShell
[int][double]::Parse((Get-Date -UFormat %s))
Other OS's
Varies by system - check documentation

Convert from Human-Readable Date to Epoch

PHP
strtotime('2023-12-25 15:30:00')
Python
import datetime; int(datetime.datetime(2023,12,25,15,30).timestamp())
Ruby
Time.parse('2023-12-25 15:30:00').to_i
Perl
use Time::Local; timelocal(0,30,15,25,11,2023)
Java
Instant.parse("2023-12-25T15:30:00Z").getEpochSecond()
C#
new DateTimeOffset(2023,12,25,15,30,0,TimeSpan.Zero).ToUnixTimeSeconds()
Objective-C
[[NSDate dateWithString:@"2023-12-25 15:30:00 +0000"] timeIntervalSince1970]
C++11
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::from_time_t(mktime(&tm)).time_since_epoch()).count()
Lua
os.time({year=2023, month=12, day=25, hour=15, min=30, sec=0})
VBScript/ASP
DateDiff("s", "01/01/1970 00:00:00", "12/25/2023 15:30:00")
AutoIT
_DateDiff('s', "1970/01/01 00:00:00", "2023/12/25 15:30:00")
Delphi
DateTimeToUnix(StrToDateTime('25/12/2023 15:30:00'))
Dart
DateTime(2023, 12, 25, 15, 30).millisecondsSinceEpoch ~/ 1000
R
as.integer(as.POSIXct("2023-12-25 15:30:00", tz="UTC"))
Erlang/OTP
calendar:datetime_to_gregorian_seconds({{2023,12,25},{15,30,0}}) - 62167219200
MySQL
SELECT UNIX_TIMESTAMP('2023-12-25 15:30:00')
PostgreSQL
SELECT extract(epoch from '2023-12-25 15:30:00'::timestamp)
SQLite
SELECT strftime('%s', '2023-12-25 15:30:00')
Oracle PL/SQL
SELECT (TO_DATE('2023-12-25 15:30:00', 'YYYY-MM-DD HH24:MI:SS') - DATE '1970-01-01') * 86400 FROM DUAL
SQL Server
SELECT DATEDIFF(s, '1970-01-01 00:00:00', '2023-12-25 15:30:00')
IBM Informix
SELECT (DATE('2023-12-25 15:30:00') - DATE('1970-01-01')) * 86400 FROM systables WHERE tabid=1
JavaScript
Math.floor(new Date('2023-12-25T15:30:00Z').getTime() / 1000)
Visual FoxPro
({^2023-12-25 15:30:00} - {^1970-01-01 00:00:00}) * 86400
Go
time.Date(2023, 12, 25, 15, 30, 0, 0, time.UTC).Unix()
Adobe ColdFusion
DateDiff("s", "January 1 1970 00:00", "December 25 2023 15:30")
Tcl/Tk
clock scan "2023-12-25 15:30:00" -format "%Y-%m-%d %H:%M:%S"
Unix/Linux Shell
date -d "2023-12-25 15:30:00" +%s
Solaris
TZ=UTC date -d "2023-12-25 15:30:00" +%s
PowerShell
[int][double]::Parse((Get-Date "2023-12-25 15:30:00" -UFormat %s))
Other OS's
Varies by system - check documentation

About Unix Timestamps

Unix timestamp (also known as Epoch time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC. It's widely used in programming and databases to represent dates and times.

Common Use Cases:
  • Database timestamps
  • API responses
  • Log file analysis
  • System administration
Key Features:
  • Timezone support
  • Bidirectional conversion
  • Real-time current timestamp
  • Multiple date formats