Skip to content
DEVELOPER UTILITY

Epoch & Unix Timestamp Converter

Convert epoch timestamps to dates and dates to epoch — with code examples for 25+ languages

Current Unix epoch time:
Epoch → Human Date

Supports seconds (10 digits), milliseconds (13), microseconds (16), and nanoseconds (19).

Result will appear here...

Quick examples:

Seconds → Duration
Quick Reference
DurationSeconds
1 minute60
1 hour3,600
1 day86,400
1 week604,800
1 month (30.44 days)2,629,743
1 year (365.25 days)31,556,926

Related Tools

What is Unix Epoch Time?

The Unix epoch (also called Unix time, POSIX time, or a Unix timestamp) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC, not counting leap seconds. This date is known as the “epoch” — the origin point of Unix time. It was chosen because it coincided with the development of the Unix operating system at Bell Labs and provided a simple, universal reference point.

Strictly speaking, “epoch” refers to Unix time 0 (the origin), but the term is commonly used as shorthand for any Unix timestamp. Unix time is defined by the POSIX standard (IEEE Std 1003.1) and is used by virtually every modern operating system, database, and programming language as the fundamental representation of time.

How Does Epoch Time Work?

Epoch time is a simple counter that increments by one every second. At the epoch (January 1, 1970, 00:00:00 UTC), the counter was 0. One hour later, it was 3,600. One day later, 86,400. Right now, it's a 10-digit number in the billions. The counter is always relative to UTC, making it timezone-independent — the same timestamp represents the same instant everywhere in the world.

Some systems store epoch time in milliseconds (13 digits, used by JavaScript and Java), microseconds (16 digits, used by some databases), or even nanoseconds (19 digits, used by Go and some high-precision systems). Our converter auto-detects the unit based on the number of digits.

Unix time deliberately ignores leap seconds — each day is exactly 86,400 seconds. This simplifies computation but means Unix time is not a perfect count of SI seconds since 1970. The difference is currently about 27 seconds.

Why Use Epoch Timestamps?

  • Timezone independence: A single integer represents the same moment worldwide — no timezone confusion, no daylight saving ambiguity.
  • Compact storage: A 4-byte or 8-byte integer is far smaller than a formatted date string like “2024-01-15T10:30:00.000Z”.
  • Easy comparison: Sorting and comparing timestamps is a simple numeric operation — no date parsing required.
  • Simple arithmetic: Adding 86,400 to an epoch gives you exactly one day later. Subtracting two epochs gives the duration between them in seconds.
  • Universal support: Every programming language, database, operating system, and API framework supports epoch timestamps natively.

Who Uses Epoch Timestamps?

Backend developers use epoch timestamps in database schemas (created_at, updated_at), API responses, and logging. Frontend developers encounter them in JavaScript (Date.now()), JWT tokens (exp, iat claims), and API integrations. DevOps engineers work with epoch in cron scheduling, log analysis, and monitoring dashboards.

Data engineers use epoch for time-series data, event streaming (Kafka timestamps), and ETL pipelines. Security professionals encounter epoch in certificate validity periods, token expiration, and audit logs.

How to Use This Tool

  1. To convert a timestamp to a date, enter the epoch value in the input field. The tool auto-detects whether it's in seconds, milliseconds, microseconds, or nanoseconds.
  2. Click Convert to see the UTC date, local date, and ISO 8601 representation.
  3. To convert a date to epoch, click Switch and enter a date string in any common format (ISO 8601, RFC 2822, or informal like “Jan 15, 2024”).
  4. Use the Seconds → Duration calculator to convert a number of seconds into years, months, days, hours, and minutes.
  5. Scroll down for copy-ready code examples in 25+ programming languages and databases.

Epoch Converter Code Examples

How to get the current epoch time and convert epoch to human-readable dates in 25+ programming languages, databases, and shells. Replace 1800000000 with your epoch value.

JavaScript
Get current epoch
Math.floor(Date.now() / 1000);
Epoch → date
new Date(1800000000 * 1000).toLocaleString();
// or .toUTCString() for GMT
Date → epoch
new Date("2024-01-15T10:30:00Z").getTime() / 1000;
Python
Get current epoch
import time
time.time()
Epoch → date
import time
time.ctime(1800000000)
Date → epoch
import calendar, time
calendar.timegm(time.strptime('2024-01-15 10:30:00', '%Y-%m-%d %H:%M:%S'))
Java
Get current epoch
long epoch = System.currentTimeMillis() / 1000;
Epoch → date
String date = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
  .format(new java.util.Date(1800000000 * 1000L));
Date → epoch
long epoch = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
  .parse("01/15/2024 10:30:00").getTime() / 1000;
C#
Get current epoch
DateTimeOffset.Now.ToUnixTimeSeconds();
Epoch → date
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
  .AddSeconds(1800000000).ToShortDateString();
Date → epoch
(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
Go
Get current epoch
time.Now().Unix()
Epoch → date
time.Unix(1800000000, 0)
Date → epoch
date, _ := time.Parse("2006-01-02", "2024-01-15")
epoch := date.Unix()
Ruby
Get current epoch
Time.now.to_i
Epoch → date
Time.at(1800000000)
Date → epoch
Time.local(2024, 1, 15, 10, 30, 0).to_i
Rust
Get current epoch
SystemTime::now()
  .duration_since(SystemTime::UNIX_EPOCH)
  .unwrap().as_secs();
Epoch → date
// Use chrono crate
use chrono::NaiveDateTime;
NaiveDateTime::from_timestamp_opt(1800000000, 0);
PHP
Get current epoch
time();
Epoch → date
date('r', 1800000000);
Date → epoch
strtotime('2024-01-15 10:30:00');
Perl
Get current epoch
time;
Epoch → date
scalar localtime(1800000000);
Date → epoch
use Time::Local;
timelocal(0, 30, 10, 15, 0, 124);
R
Get current epoch
as.numeric(Sys.time())
Epoch → date
as.POSIXct(1800000000, origin="1970-01-01", tz="GMT")
Date → epoch
as.numeric(as.POSIXct("2024-01-15 10:30:00", tz="GMT", origin="1970-01-01"))
Dart
Get current epoch
DateTime.now().millisecondsSinceEpoch ~/ 1000;
Epoch → date
DateTime.fromMillisecondsSinceEpoch(1800000000 * 1000);
C / C++
Get current epoch
// C
#include <time.h>
time(NULL);

// C++
auto now = std::chrono::duration_cast<std::chrono::seconds>(
  std::chrono::system_clock::now().time_since_epoch()
).count();
Epoch → date
// C
time_t epoch = 1800000000;
printf("%s", ctime(&epoch));
Lua
Get current epoch
os.time()
Epoch → date
os.date('%c', 1800000000)
Delphi
Get current epoch
DateTimeToUnix(Now, False);
Epoch → date
DateTimeToStr(UnixToDateTime(1800000000));
MySQL
Get current epoch
SELECT UNIX_TIMESTAMP(NOW());
Epoch → date
SELECT FROM_UNIXTIME(1800000000);
Date → epoch
SELECT UNIX_TIMESTAMP('2024-01-15 10:30:00');
PostgreSQL
Get current epoch
SELECT EXTRACT(EPOCH FROM now());
Epoch → date
SELECT TO_TIMESTAMP(1800000000);
Date → epoch
SELECT EXTRACT(EPOCH FROM date('2024-01-15 10:30'));
SQL Server
Get current epoch
SELECT DATEDIFF(SECOND, '1970-01-01', GETUTCDATE());
Epoch → date
SELECT DATEADD(SECOND, 1800000000, '1970-01-01');
SQLite
Get current epoch
SELECT unixepoch();
Epoch → date
SELECT datetime(1800000000, 'unixepoch');
Google BigQuery
Get current epoch
SELECT UNIX_SECONDS(CURRENT_TIMESTAMP());
Epoch → date
SELECT TIMESTAMP_SECONDS(1800000000);
Oracle PL/SQL
Get current epoch
SELECT (CAST(SYS_EXTRACT_UTC(SYSTIMESTAMP) AS DATE)
  - TO_DATE('01/01/1970','DD/MM/YYYY')) * 86400 FROM DUAL;
Epoch → date
SELECT TO_DATE('01-JAN-1970','dd-mon-yyyy')
  + (1800000000/86400) FROM DUAL;
Unix / Linux Shell
Get current epoch
date +%s
Epoch → date
date -d @1800000000
Date → epoch
date +%s -d"Jan 15, 2024 10:30:00"
macOS
Get current epoch
date +%s
Epoch → date
date -j -r 1800000000
PowerShell
Get current epoch
[DateTimeOffset]::Now.ToUnixTimeSeconds()
Epoch → date
[DateTimeOffset]::FromUnixTimeSeconds(1800000000).LocalDateTime
Excel / LibreOffice
Get current epoch
N/A — use formulas below
Epoch → date
=(A1 / 86400) + 25569
(Format cell as Date/Time. A1 = epoch in seconds. Result is GMT.)
Date → epoch
=(A1 - 25569) * 86400
(A1 = date cell. Result is epoch in seconds.)
Objective-C
Get current epoch
[[NSDate date] timeIntervalSince1970];
Epoch → date
[NSDate dateWithTimeIntervalSince1970:1800000000];
Groovy / Jenkins
Get current epoch
System.currentTimeMillis() / 1000
Epoch → date
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter

def formatter = DateTimeFormatter.ofPattern('dd-MM-yyyy HH:mm:ss')
  .withZone(ZoneId.of('UTC'))
println formatter.format(Instant.ofEpochSecond(1800000000))
Erlang / OTP
Get current epoch
erlang:system_time(seconds).
Epoch → date
calendar:gregorian_seconds_to_datetime(
  1800000000 + 62167219200).
Tcl / Tk
Get current epoch
clock seconds
Epoch → date
clock format 1800000000
MATLAB
Get current epoch
posixtime(datetime('now','TimeZone','UTC'))
Epoch → date
datestr(719529 + 1800000000/86400, 'dd-mmm-yyyy HH:MM:SS')

Frequently Asked Questions About Epoch & Unix Timestamps