(PECL mongo >= 1.6.0; PHP > 5.3.4)
MongoDate::toDateTime — Returns a DateTime object representing this date
This extension that defines this method is deprecated. Instead, the MongoDB extension should be used. Alternatives to this method include:
Returns a DateTime object representation of this date.
Diese Funktion hat keine Parameter.
This date as a DateTime object.
Beispiel #1 MongoDate::toDateTime() example
This example demonstrates creating a DateTime object from a MongoDate object.
<?php
$d = new MongoDate(strtotime("2014-11-18 11:01:25"));
var_dump( $d->toDateTime() );
?>
Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
class DateTime#2 (3) { public $date => string(26) "2014-11-18 11:01:25.000000" public $timezone_type => int(1) public $timezone => string(6) "+00:00" }