1

I have an export of MongoDB data that includes time stamp such as

lastRunEnd = 1549036780246

When I select this value as select to_timestamp (('1549036780246'::double precision)) as lastRunEnd I get: 51057-01-08 05:30:46

Where I expect 2019-02-01 15:59:40.... Here is value as written in Mongo "lastRunEnd" : ISODate("2019-02-01T15:59:40.246Z")

From Documentation > BSON has a special timestamp type for internal MongoDB use and is not associated with the regular Date type. Timestamp values are a 64 bit value where:

the first 32 bits are a time_t value (seconds since the Unix epoch) the second 32 bits are an incrementing ordinal for operations within a given second.

How do I covert this ISO date to Postgerss timestamp format?

Using Posgress 11

closed as off-topic by mustaccio, MDCCL, Marcello Miorelli, Tony Hinkle, Vérace Jun 6 at 15:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – mustaccio, MDCCL, Marcello Miorelli, Tony Hinkle, Vérace
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    1549036780246 is not an ISO date; it's Unix time in milliseconds; divide it by 1000. – mustaccio Jun 5 at 16:19
  • Thank you !!! select to_timestamp ((1549036780246 / 1000 ::double precision)) as lastRunEnd – Data Tale Jun 5 at 16:26

Browse other questions tagged or ask your own question.