Select date only without the hour on postgresql
Cast to date
:
select "date" from table where "date"::date = '2017-01-01'
Note that I enclosed references to the date
column in double quotes, because date
is a Postgres keyword. You should avoid naming your columns, tables, or schemas using keywords.
Use date()
function, it will extract date
from datetime like:
select DATE(my_field) from my_table;