Hi im trying to extract time from a timestamp in Postgres
SELECT extract(time from '2000-01-01 01:12:00'::timestamp)
Result should be: 01:12:00
It looks like that time is not a valid argument for extract. Is that right?
select '2000-01-01 01:12:00'::timestamp::time
Try this:
s=# SELECT cast ('2000-01-01 01:12:00'::timestamp as time);
time
----------
01:12:00
(1 row)
doesn't extract - then, you might want to use cast
.
and yes - https://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
time
is not a valid aprt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With