views:

105

answers:

2

I want to to select the time of a date from database. How can I do this using postgresql database?

Thanks in advance

A: 

You can use the date_part function, like this:

date_part('hour', timestamp '2001-02-16 20:38:40')

This would give you 20 for example.

For more information, refer to http://www.postgresql.org/docs/8.2/interactive/functions-datetime.html

Robban
A: 

Not sure what you exactly mean. Perhaps answer to your question is:

select now();

or maybe it's:

select now()::time;
depesz