Skip to content
Advertisement

Convert hh:mm:ss.ms to millisecond in postgres

I have doubt. how to convert hh:mm:ss.ms to millisecond in Postgres.

For example 01:25:43.81 to 5143810

Advertisement

Answer

You could do:

extract(epoch from '01:25:43.81'::time) * 1000

The other way around:

'00:00:00'::time + 5143810/1000.0 * interval '1' second
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement