Execute:
SELECT NOW()
and it appears to me:
'2017-08-07 10:53:44.207-06'
And I want to appear
'2017-08-07'
Execute:
SELECT NOW()
and it appears to me:
'2017-08-07 10:53:44.207-06'
And I want to appear
'2017-08-07'
The function now()
returns an object of type timestamp with time zone
. If you want to obtain only the part of the date, it is necessary to cast the data type date
.
This can be done through:
SELECT CAST(now() AS date);
or with the following syntax, which is typical of PostgreSQL (it is not standard SQL)
SELECT now()::date;
More info about castings in PostreSQL here