Epoch & Unix Timestamp in Go
Get the current epoch timestamp
epochSeconds := time.Now().Unix() Convert epoch to date
t := time.Unix(1718200000, 0).UTC() Convert date to epoch
epoch := time.Date(2026, 6, 12, 0, 0, 0, 0, time.UTC).Unix() Go notes
time.Now().UnixMilli(), UnixMicro() and UnixNano() give the other units. time.Unix takes (seconds, nanoseconds) — the second argument is an offset, not a unit selector.
Check any value live with the epoch converter, or read what Unix time actually counts.
Other languages
C · C# · C++ · Dart · Java · JavaScript · Kotlin · MySQL · Perl · PHP · PostgreSQL · Python · R · Ruby · Rust · Scala · SQLite · Swift · TypeScript