Skip to content
Advertisement

Insertion by removing ‘000000’ in the unix timestamp

I’m inserting some data for python that comes from a GET in API FLASK like JSON, for some reason when python will insert this data or maybe postgres itself, it is removing the 000000

Data json:

Insert py:

Original date:

Date that python is inserting to pgsql:

Conversion correct:

enter image description here

Even using the website’s timezone, it returns with a problem select to_timestamp(1585983000000) AT TIME ZONE 'GMT-03:00' --> 52227-10-20 20:20:00

Advertisement

Answer

Your timestamp value (datecollect) is apparently in milliseconds; you just need to divide it by 1000 to convert it from milliseconds to seconds:

Output:

So for your query:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement