user13641224
user13641224

Reputation: 161

Is there any official document about the date( ) function in Postgres?

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

Answers (1)

user330315
user330315

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 equivalent float8 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

Related Questions