Epoch Converter for PostgreSQL — EXTRACT(EPOCH) & to_timestamp
Quick Answer: PostgreSQL converts epoch to timestamp with to_timestamp(1704067200) and timestamp to epoch with EXTRACT(EPOCH FROM timestamp). Always use timestamptz (timestamp with time zone) to avoid timezone ambiguity.
Current Unix Epoch
1776009213
2026-04-12T15:53:33.000Z
FAQ
Should I use timestamp or timestamptz in PostgreSQL?
Always use timestamptz. It stores the value in UTC and converts to the session timezone on display. Plain timestamp has no timezone info and causes bugs.
How do I get current epoch in PostgreSQL?
SELECT EXTRACT(EPOCH FROM NOW())::integer; or SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)::bigint; for a bigint result.