I need to convert number to timestamp in PostgreSQL. I got numbers in database as character varying. I have seen there is a lot of solutions for integers but I got decimal numbers and here comes the issue.
The max I got is something like below using '1899-12-30'::DATE + CAST(Round(CAST(REPLACE(Excel_date_number, ',','.') as DOUBLE PRECISION)) as INTEGER)
Value | Date |
---|---|
45279,4029282407 | 2023-12-19 |
45294,5203472222 | 2024-01-04 |
45309,2083333333 | 2024-01-18 |
But I am completely lost in getting thw whole timestamp from these numbers. Can you give me any ideas how could I handle this?
Value
supposed to be part of the timestamp. If so what is it, anepoch
value or something else? FYI, you can deal with the,
as decimal separator by changinglc_numeric
to a locale that uses a,
that way.