Calculate the time between these two timestamps in PostgreSQL, create_time='2017-11-02 05:51:13' and update_time='2017-11-02 07:36:18'
and display it on HH:MM:SS Format. it should display like this 01:45:04
You can try just subtracting the two timestamps, then using to_char to extract out the time portion:
select
SELECT to_char('2017-11-02 07:36:18'::timestamp -
'2017-11-02 05:51:10'::timestamp, 'HH:MI:SS');
Output:
to_char
01:45:08
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