charles
charles

Reputation: 219

Get part of current_timestamp in PostgreSQL

When I do

select CURRENT_TIMESTAMP

I get 2021-02-02 13:58:44.

I want take only this part: 13:58:44 and store it in a variable.

Upvotes: 0

Views: 33

Answers (1)

S-Man
S-Man

Reputation: 23686

demo:db<>fiddle

You can cast a timestamp into type time:

SELECT CURRENT_TIMESTAMP::time

Or you can localtime directly.

Upvotes: 2

Related Questions