date_part ( text, timestamp ) → double precisionGet timestamp subfield (equivalent to
extract); see Section 9.9.1date_part('hour', timestamp '2001-02-16 20:38:40') → 20Functions / Date/Time Functions And Operators
Get timestamp subfield (equivalent to extract); see Section 9.9.1
Reading PG 18current·documented in 27 of 27 versions, 7.1 to 20
date_part ( text, timestamp ) → double precisionGet timestamp subfield (equivalent to
extract); see Section 9.9.1date_part('hour', timestamp '2001-02-16 20:38:40') → 20date_part ( text, interval ) → double precisionGet interval subfield (equivalent to
extract); see Section 9.9.1date_part('month', interval '2 years 3 months') → 3date_part('field', source)Note that here the field parameter needs to be a string value, not a name. The valid field names for date_part are the same as for extract. For historical reasons, the date_part function returns values of type double precision. This can result in a loss of precision in certain uses. Using extract is recommended instead.Definition snapshot: b7bd9cda · English manual source