Find timestamp from objectId in mongo

How to find TimeStamp from ObjectId in mongo

Input : _id:"602f2d5aa1d36ac7807d0091"

Aproach:using getTimestamp() method of ObjectId

ObjectId("602f2d5aa1d36ac7807d0091").getTimestamp();

Output:

ISODate("2021-02-19T03:15:38Z")


No comments:

Post a Comment