Reputation: 161
PostgreSQL manual
I have read the Postgres manual about the date function for many hours but i can't find any instruction about the use of date( )
in Postgres.
Consider the following
select DATE('2010-01-01 12:00:00');
date
------------
2010-01-01
Where can i get the official document recording the use of DATE () here?
Upvotes: 1
Views: 44
Reputation:
It's a different way of writing a type cast
It is also possible to specify a type cast using a function-like syntax:
typename ( expression )
However, this only works for types whose names are also valid as function names. For example,double precision
cannot be used this way, but the equivalentfloat8
can
So, DATE('2010-01-01 12:00:00')
is equivalent to '2010-01-01 12:00:00'::date
or cast('2010-01-01 12:00:00' as date)
Upvotes: 4