Skip to content

SQL datetime to YYYY converter

SQL datetime (YYYY-MM-DD HH:mm:ss) → Year only (YYYY)

About YYYY

YYYY · YYYY

2022

Worked examples

InstantSQL datetimeYYYY
an ordinary afternoon2026-06-29 14:30:002026
a leap day2028-02-29 09:05:072028
the Unix epoch1970-01-01 00:00:001970

What this conversion changes

  • Dropped on the way out: month, day, hour, minutes, seconds. The conversion is lossy; converting back will not restore them.

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

YYYY — Year only (YYYY)

Pattern
YYYY
Example
2024
Seen in
Reports grouped by year, Copyright lines

Thousands of values to convert?

CSV batch mode converts an entire column from SQL datetime to YYYY (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.