array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'mongodb-bson-utcdatetime.construct.php', 1 => 'MongoDB\\BSON\\UTCDateTime::__construct', ), 'up' => array ( 0 => 'class.mongodb-bson-utcdatetime.php', 1 => 'MongoDB\\BSON\\UTCDateTime', ), 'prev' => array ( 0 => 'class.mongodb-bson-utcdatetime.php', 1 => 'MongoDB\\BSON\\UTCDateTime', ), 'next' => array ( 0 => 'mongodb-bson-utcdatetime.jsonserialize.php', 1 => 'MongoDB\\BSON\\UTCDateTime::jsonSerialize', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mongodb/bson/utcdatetime/construct.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(mongodb >=1.0.0)
MongoDB\BSON\UTCDateTime::__construct — Construct a new UTCDateTime
milliseconds
(int|float|string|DateTimeInterface|null)Number of milliseconds since the Unix epoch (Jan 1, 1970). Negative values represent dates before 1970. This value may be provided as a 64-bit int. For compatibility on 32-bit systems, this parameter may also be provided as a float or string.
If the argument is a DateTimeInterface, the number of milliseconds since the Unix epoch will be derived from that value.
If this argument is null
, the current time will be used by default.
Versão | Descrição |
---|---|
PECL mongodb 1.2.0 |
The |
Exemplo #1 MongoDB\BSON\UTCDateTime::__construct() example
<?php
var_dump(new MongoDB\BSON\UTCDateTime);
var_dump(new MongoDB\BSON\UTCDateTime(new DateTime));
var_dump(new MongoDB\BSON\UTCDateTime(1416445411987));
?>
O exemplo acima produzirá algo semelhante a:
object(MongoDB\BSON\UTCDateTime)#1 (1) { ["milliseconds"]=> string(13) "1484852905560" } object(MongoDB\BSON\UTCDateTime)#1 (1) { ["milliseconds"]=> string(13) "1484852905560" } object(MongoDB\BSON\UTCDateTime)#1 (1) { ["milliseconds"]=> string(13) "1416445411987" }