Epoch & Unix Timestamp in SQLite

Get the current epoch timestamp

SELECT unixepoch();

Convert epoch to date

SELECT datetime(1718200000, 'unixepoch');

Convert date to epoch

SELECT unixepoch('2026-06-12 00:00:00');

SQLite notes

unixepoch() requires SQLite 3.38+; older versions use strftime('%s', 'now'). All SQLite date functions work in UTC unless you append the 'localtime' modifier.

Check any value live with the epoch converter, or read what Unix time actually counts.

Other languages

C · C# · C++ · Dart · Go · Java · JavaScript · Kotlin · MySQL · Perl · PHP · PostgreSQL · Python · R · Ruby · Rust · Scala · Swift · TypeScript