Skip to content
Advertisement

Getting timestamp from mongodb id

How do I get the timestamp from the MongoDB id?

Advertisement

Answer

The timestamp is contained in the first 4 bytes of a mongoDB id (see: http://www.mongodb.org/display/DOCS/Object+IDs).

So your timestamp is:

JavaScript

and

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