PHP Velho Oeste 2024

MongoId::getTimestamp

(PECL mongo >= 1.0.1)

MongoId::getTimestampGets the number of seconds since the epoch that this id was created

Açıklama

public MongoId::getTimestamp ( void ) : int

This returns the same thing as running time() when the id is created.

Değiştirgeler

Bu işlevin değiştirgesi yoktur.

Dönen Değerler

Returns the number of seconds since the epoch that this id was created. There are only four bytes of timestamp stored, so MongoDate is a better choice for storing exact or wide-ranging times.

add a note add a note

User Contributed Notes 2 notes

up
1
le6o
7 years ago
There is no equivalent for this method in the new extension, so instead use…

<?php
$id
= new \MongoDB\BSON\ObjectID('42cf58a2e1c5ede216cb7f05');
$timestamp = hexdec(substr($id, 0, 8));
?>
To Top