HWid
HWid

Reputation: 85

Converting time datatype to xxhxxmxxs

I wonder if there is any function in postgres that can easily convert values stored as 00:00:00 to more human friendly format: 3h 5m ?

Upvotes: 0

Views: 103

Answers (1)

Houari
Houari

Reputation: 5631

You can use to_char function:

select to_char(cast('05:03:00' as time), 'HH24h MIm SSs');

This will produce

05h 03m 00s

Upvotes: 1

Related Questions