MongoId::getTimestamp
(PECL mongo >= 1.0.1)
MongoId::getTimestamp — Gets the number of seconds since the epoch that this id was created
Описание
public int MongoId::getTimestamp
( void
)
This returns the same thing as running time() when the id is created.
Список параметров
У этой функции нет параметров.
Возвращаемые значения
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.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- MongoDB
- Types
- Функция MongoId::__construct() - Creates a new id
- Функция MongoId::getHostname() - Gets the hostname being used for this machine's ids
- Функция MongoId::getInc() - Gets the incremented value to create this id
- Функция MongoId::getPID() - Gets the process ID
- Функция MongoId::getTimestamp() - Gets the number of seconds since the epoch that this id was created
- Функция MongoId::isValid() - Check if a value is a valid ObjectId
- Функция MongoId::__set_state() - Create a dummy MongoId
- Функция MongoId::__toString() - Returns a hexidecimal representation of this id
Коментарии
There is no equivalent for this method in the new extension, so instead use…
<?php
$id = new MongoDBBSONObjectID('42cf58a2e1c5ede216cb7f05');
$timestamp = hexdec(substr($id, 0, 8));
?>
see mongodb-bson-objectid.gettimestamp