翻译或纠错本页面
- Reference >
- mongo Shell Methods >
- Object Constructors and Methods >
- ObjectId.getTimestamp()
ObjectId.getTimestamp()¶
On this page
- ObjectId.getTimestamp()¶
Returns the timestamp portion of the ObjectId() as a Date.
下面的例子中,调用一个 ObjectId 对象 (e.g. ObjectId("507c7f79bcf86cd7994f6c0e")) 的 getTimestamp() 方法:¶
The following example calls the getTimestamp() method on an ObjectId():
ObjectId("507c7f79bcf86cd7994f6c0e").getTimestamp()
从 ObjectId() 对象中取出时间戳并转换成 Date 类型 。
ISODate("2012-10-15T21:26:17Z")