Course
Simulator
More
Premium
Log in
PostgreSQL Function Reference
Functions
DATE_PART
DATE_PART
Extracts a subfield from a date/time value.
PostgreSQL 17.5
DATE_PART
(
field
,
source
)
field
The field to extract (year, month, day, etc.).
source
The date/time value.
Examples
PostgreSQL 17.5
SELECT
DATE_PART
(
'year'
,
TIMESTAMP
'2023-01-01'
)