I have time column (string) which looks like this:
time
1645437571.1399999
1645437571.14
1645437571.1455667
1645437571.2
1645437572
1645738427
1645738427
When I do:
select to_timestamp(1645437571.1399999);
individually for each value in that column I always get proper response, something like:
2022-02-21 09:59:31.140000 +00:00
But when I do:
select to_timestamp(time) from pmu;
I get error:
[42883] ERROR: function to_timestamp(character varying) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts. Position: 8
I understand it's because characters are varying so if I define some format like this:
select to_timestamp(time, 'DD-MM-YYYY SS:MS:US') from pmu;
Than I get:
[22008] ERROR: date/time field value out of range: "1645437571.14" It should also work for empty values.
to_timestamp(varchar) does not exist. You have to cast your data before using to_timestamp
select to_timestamp(time::numeric) from pmu;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.