Epoch Converter
Unix epoch ⇄ timestamps in any timezone.
Code snippets
Java
epoch → timestamp (with timezone)
import java.time.*;
long epoch = 1787000000L;
ZonedDateTime dt = Instant.ofEpochSecond(epoch)
.atZone(ZoneId.of("America/New_York"));
System.out.println(dt); // 2026-…-04:00[America/New_York]timestamp → epoch
import java.time.*;
ZonedDateTime dt = ZonedDateTime.of(
2026, 8, 14, 10, 0, 0, 0,
ZoneId.of("America/New_York"));
long epoch = dt.toEpochSecond();Scala
epoch → timestamp (with timezone)
import java.time._
val epoch = 1787000000L
val dt = Instant.ofEpochSecond(epoch)
.atZone(ZoneId.of("America/New_York"))
println(dt)timestamp → epoch
import java.time._
val dt = ZonedDateTime.of(
2026, 8, 14, 10, 0, 0, 0,
ZoneId.of("America/New_York"))
val epoch = dt.toEpochSecondPython
epoch → timestamp (with timezone)
from datetime import datetime
from zoneinfo import ZoneInfo
epoch = 1787000000
dt = datetime.fromtimestamp(epoch, tz=ZoneInfo("America/New_York"))
print(dt) # 2026-…-04:00timestamp → epoch
from datetime import datetime
from zoneinfo import ZoneInfo
dt = datetime(2026, 8, 14, 10, 0,
tzinfo=ZoneInfo("America/New_York"))
epoch = int(dt.timestamp())Go
epoch → timestamp (with timezone)
import "time"
epoch := int64(1787000000)
loc, _ := time.LoadLocation("America/New_York")
t := time.Unix(epoch, 0).In(loc)
fmt.Println(t)timestamp → epoch
import "time"
loc, _ := time.LoadLocation("America/New_York")
t := time.Date(2026, 8, 14, 10, 0, 0, 0, loc)
epoch := t.Unix()Bash
epoch → timestamp (with timezone)
# GNU/Linux
TZ="America/New_York" date -d @1787000000
# macOS / BSD
TZ="America/New_York" date -r 1787000000timestamp → epoch
# GNU/Linux (time interpreted in America/New_York)
TZ="America/New_York" date -d "2026-08-14 10:00:00" +%s
# macOS / BSD
TZ="America/New_York" date -j -f "%Y-%m-%d %H:%M:%S" \
"2026-08-14 10:00:00" +%sRuby
epoch → timestamp (with timezone)
ENV["TZ"] = "America/New_York"
epoch = 1787000000
puts Time.at(epoch) # 2026-… -0400timestamp → epoch
ENV["TZ"] = "America/New_York"
epoch = Time.local(2026, 8, 14, 10, 0, 0).to_i
puts epochPerl
epoch → timestamp (with timezone)
use POSIX qw(strftime);
$ENV{TZ} = "America/New_York";
my $epoch = 1787000000;
print strftime("%Y-%m-%d %H:%M:%S %Z",
localtime($epoch)), "\n";timestamp → epoch
use Time::Local;
$ENV{TZ} = "America/New_York";
# note: month is 0-based (7 = August)
my $epoch = timelocal(0, 0, 10, 14, 7, 2026);
print "$epoch\n";Swift
epoch → timestamp (with timezone)
import Foundation
let date = Date(timeIntervalSince1970: 1787000000)
let df = DateFormatter()
df.timeZone = TimeZone(identifier: "America/New_York")
df.dateFormat = "yyyy-MM-dd HH:mm:ss zzz"
print(df.string(from: date))timestamp → epoch
import Foundation
let df = DateFormatter()
df.timeZone = TimeZone(identifier: "America/New_York")
df.dateFormat = "yyyy-MM-dd HH:mm:ss"
let epoch = df.date(from: "2026-08-14 10:00:00")!
.timeIntervalSince1970
print(Int(epoch))JavaScript
epoch → timestamp (with timezone)
const epoch = 1787000000;
const s = new Date(epoch * 1000).toLocaleString(
"en-CA",
{ timeZone: "America/New_York", hour12: false }
);
console.log(s);timestamp → epoch
// ISO string with explicit offset
const epoch = Math.floor(
new Date("2026-08-14T10:00:00-04:00").getTime() / 1000
);
console.log(epoch);Right now
Epoch (seconds)
1787529322Epoch (milliseconds)
1787529322956UTC
2026-08-23 23:55:22 UTCUTC
2026-08-23 23:55:22 UTCConvert epoch
Seconds or milliseconds — detected automatically.