pmiranda
pmiranda

Reputation: 8420

TO_CHAR PostgreSQL

I have this query:

SELECT hora FROM table;

I got "09:45:00"

Now, I'm trying to get the hour from that timestamp, and I'm trying:

SELECT TO_CHAR(hora,'HH24'), hora FROM table;

I was expecting: 9 | 09:45:00

But I got this error:

Undefined function: 7 ERROR: function doesn't exist to_char(character varying, unknown)

What I'm doing wrong?

Upvotes: 1

Views: 3538

Answers (1)

Slumdog
Slumdog

Reputation: 470

SELECT TO_CHAR('09:45:00'::time,'HH24') ;

Upvotes: 3

Related Questions