Reputation: 6733
I need to display only the hours of the time. The following script is my attempt to do the same.
Example:
select left(visittime,2) from records;
Here visittime
contains:
10:00:00;
So I need to display only the 10 from it. I have tried by using above script but I am getting an error.
Error:
function left(time without time zone, integer) does not exist
Upvotes: 0
Views: 287
Reputation: 5669
Another alternative is to use the EXTRACT function, as below:
select extract(hour from visittime) from records;
Reference:
Date/Time Functions and Operators on PostgreSQL Documentation
Upvotes: 3