php8.5
Home/ Manual/ bson / timestamp/ MongoDB\BSON\Timestamp::__construct

MongoDB\BSON\Timestamp::__construct

PHP function Edit on GitHub ✎

(mongodb >=1.0.0)

Construct a new Timestamp

Description

MongoDB\BSON\Timestamp::__construct(int $increment, int $timestamp)

Parameters

increment (int)

32-bit integer denoting the incrementing ordinal for operations within a given second.

timestamp (int)

32-bit integer denoting seconds since the Unix epoch.

Errors/Exceptions

Examples

MongoDB\BSON\Timestamp::__construct() example

php
<?php

$timestamp = new MongoDB\BSON\Timestamp(1234, 5678);

?>

The above example will output:

output
object(MongoDB\BSON\Timestamp)#1 (2) {
  ["increment"]=>
  int(1234)
  ["timestamp"]=>
  int(5678)
}

See Also

  • BSON Types: Timestamps

Source: reference/mongodb/bson/timestamp/construct.xml · from the official PHP manual (php/doc-en)