Unix epoch to date
Convert unix epoch to human-readable date
Timestamp Type: Seconds
GMT : November 21, 2024 at 6:48:08 AM UTC
Your Time Zone: November 21, 2024 at 6:48:08 AM UTC
Relative: 0 seconds ago

Date to Epoch

Convert human-readable date to Epoch
Epoch Timestamp: 1732171688
Epoch Milliseconds : 1732171688007
Relative: in 0 seconds

What is Epoch

The concept of the Unix epoch, also referred to as Unix time, POSIX time, or Unix timestamp, denotes the count of seconds elapsed since January 1, 1970 (midnight UTC/GMT), excluding leap seconds (ISO 8601: 1970-01-01T00:00:00Z). While technically pinpointing Unix time 0 (midnight 1/1/1970), the term 'epoch' is commonly used synonymously with Unix time.

Example

Here are some conversions of common time intervals to seconds and milliseconds.

TimeSeconds (s)MilliSeconds (ms)
1 Hour3,600 Seconds3,600,000 MilliSeconds
1 Day86,400 Seconds86,400,000 MilliSeconds
1 Week604,800 Seconds604,800,000 MilliSeconds
1 Year31,556,926 Seconds31,556,952,000 MilliSeconds

How to get current Epoch in various tools

Here are some examples of how to get the current epoch in various programming languages and tools.

LanguageSnippet
Javascript Math.floor(new Date().getTime()/1000)
Pythonimport time; print(int(time.time()))
JavaSystem.out.println(System.currentTimeMillis() / 1000);
Gofmt.Println(time.Now().Unix())
Rubyputs Time.now.to_i
PHPecho time();
C#Console.WriteLine((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds);
Swiftprint(Int(NSDate().timeIntervalSince1970))
Kotlinprintln(System.currentTimeMillis() / 1000)
Rustprintln!("{}", SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs());
Cprintf("%ld\n", (long)time(NULL));
C++std::cout << std::time(0) << std::endl;
Perlprint time;
Linux/Unixdate +%s
PostgresSELECT extract(epoch from now());
MySQLSELECT UNIX_TIMESTAMP();
OracleSELECT (SYSDATE - TO_DATE('1970-01-01', 'YYYY-MM-DD')) * 86400 FROM DUAL;
SQL ServerSELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE());

Read more

  1. A Beginner's Guide to Epoch Time
  2. Epoch Time Conversion