I have a table which one of the columns is of type TIMESTAMP(6).
How do I get the milliseconds of the column's data since 1970 UTC?
Try this
select (cast(your_column as date) - date '1970-01-01')*24*60*60 from your_table;
select
MY_TS as orig
, extract(day from (MY_TS-to_timestamp_tz('01-01-70 0', 'DD-MM-RR TZH')))*1000*60*60*24
+ extract(hour from (MY_TS-to_timestamp_tz('01-01-70 0', 'DD-MM-RR TZH')))*1000*60*60
+ extract(minute from (MY_TS-to_timestamp_tz('01-01-70 0', 'DD-MM-RR TZH')))*1000*60
+ extract(second from (MY_TS-to_timestamp_tz('01-01-70 0', 'DD-MM-RR TZH')))*1000
as millis
from MY_TABLE;
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