DATE
Converts a value to the date type and drops the time.
PostgreSQL 17.9
DATE(value)- value
- Timestamp or a string with a datetimestamp | text
Return value
A date (date) without time; a string with a non-existent date causes an error
Examples
Date without time
PostgreSQL 17.9
SELECT DATE('2022-12-05 10:37:22');The same with the :: operator
PostgreSQL 17.9
SELECT DATE('2022-12-05 10:37:22') AS function_style,
'2022-12-05 10:37:22'::date AS cast_style;Details
DATE(value) is a type cast written as a function, the same as value::date or CAST(value AS date).