J
J
JoseKadur2021-04-26 21:57:10
PostgreSQL
JoseKadur, 2021-04-26 21:57:10

How to convert columns to time format?

I don't understand how to do it on columns.
1591044532022001 - value from event_timestamp column
1 591 044 464 658 000.00 - value from user_first_touch_timestamp column

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Derepko, 2021-04-26
@uDenX

https://www.blendo.co/documents/queries-casting-po... .

S
Slava Rozhnev, 2021-04-26
@rozhnev

Try like this:

SELECT 
  to_timestamp(('1591044532022001'::bigint)/1000000) ts1,
  to_timestamp((regexp_replace('1 591 044 464 658 000,00', '[\s,]','','g')::bigint)/100000000) ts2

PostgreSQL fiddle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question