array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'mongodb-bson-utcdatetime.todatetimeimmutable.php', 1 => 'MongoDB\\BSON\\UTCDateTime::toDateTimeImmutable', 2 => 'Returns the DateTimeImmutable representation of this UTCDateTime', ), 'up' => array ( 0 => 'class.mongodb-bson-utcdatetime.php', 1 => 'MongoDB\\BSON\\UTCDateTime', ), 'prev' => array ( 0 => 'mongodb-bson-utcdatetime.todatetime.php', 1 => 'MongoDB\\BSON\\UTCDateTime::toDateTime', ), 'next' => array ( 0 => 'mongodb-bson-utcdatetime.tostring.php', 1 => 'MongoDB\\BSON\\UTCDateTime::__toString', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mongodb/bson/utcdatetime/todatetimeimmutable.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(mongodb >=1.20.0)
MongoDB\BSON\UTCDateTime::toDateTimeImmutable — Returns the DateTimeImmutable representation of this UTCDateTime
Diese Funktion besitzt keine Parameter.
Returns the DateTimeImmutable representation of this UTCDateTime. The returned DateTimeImmutable will use the UTC time zone.
Beispiel #1 MongoDB\BSON\UTCDatetime::toDateTimeImmutable() example
<?php
$utcdatetime = new MongoDB\BSON\UTCDateTime(1416445411987);
$datetime = $utcdatetime->toDateTimeImmutable();
var_dump($datetime->format('r'));
var_dump($datetime->format('U.u'));
var_dump($datetime->getTimezone());
?>
Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
string(31) "Thu, 20 Nov 2014 01:03:31 +0000" string(17) "1416445411.987000" object(DateTimeZone)#3 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }