ANNOUNCEMENT: Voyage AI joins MongoDB to power more accurate and trustworthy AI applications on Atlas.
Learn more
Docs Menu

ObjectId.getTimestamp()

On this page

ObjectId.getTimestamp()

Returns the timestamp portion of the ObjectId() as a Date.

The following example calls the getTimestamp() method on an ObjectId():

ObjectId("507c7f79bcf86cd7994f6c0e").getTimestamp()

This will return the following output:

ISODate("2012-10-15T21:26:17Z")

See also:

On this page