Skip to content

Unix timestamp to SQL datetime converter

Unix timestamp in seconds → SQL datetime (YYYY-MM-DD HH:mm:ss)

SQL datetime · YYYY-MM-DD HH:mm:ss

2024-06-29 00:00:00

A Unix timestamp has no clock of its own: it is written as its UTC clock.

Worked examples

InstantUnix timestampSQL datetime
an ordinary afternoon17827434002026-06-29 14:30:00
a leap day18354279072028-02-29 09:05:07
the Unix epoch01970-01-01 00:00:00

What this conversion changes

  • Unix timestamp counts seconds since 1970-01-01T00:00:00Z; the result is that instant written as calendar fields in UTC.

Unix timestamp — Unix timestamp in seconds

Pattern
Unix Timestamp (sec)
Example
1719619200
Seen in
Linux and Unix tools, PHP time(), Python time.time(), JWT exp/iat claims, Stripe and most payment APIs

SQL datetime — SQL datetime (YYYY-MM-DD HH:mm:ss)

Pattern
YYYY-MM-DD HH:mm:ss
Example
2022-06-29 13:45:31
Seen in
MySQL DATETIME, PostgreSQL timestamp, SQLite, CSV exports from databases

Thousands of values to convert?

CSV batch mode converts an entire column from Unix timestamp to SQL datetime (or any of the 82 formats, with time-zone shifts), entirely in your browser, with no row limit set by us (your device's memory is the practical ceiling). $9.99/month, hides the ads, cancel anytime.