Docs Menu

Docs HomeMongoDB Manual

ObjectId.getTimestamp()

On this page

  • Example
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")

Tip

See also:

←  ObjectId.createFromHexString()ObjectId.toString() →

On this page

Share Feedback
© 2023 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.