Reputation: 31237
In my MongoDB
item
collection, which has got the date
field of reviews
array. The date
field looks like this:
From the MongoDB docs:
Internally, Date objects are stored as a 64 bit integer representing the number of milliseconds since the Unix epoch (Jan 1, 1970)
What is the meaning of this date number?
Looking at this number on shell itself how do I judge which date it is?
Upvotes: 1
Views: 492
Reputation: 43235
This is unix timestamp in milliseconds, you can convert it to date object in any language you are using. And this is NOT the date object which mongodb has, the programmer here has put unix timestamp through the script in integer format, not Date.
Though the value of the eventual date ( after calculations ) would be equivalent, but there are more operations that mongoDb date supports, like timezone awareness, $day etc operations, direct conversion to date object in language drivers .e.g datetime
in pymongo.
Upvotes: 1