(PECL mongo >= 0.8.1)
MongoDate::__construct — Creates a new date.
$sec
= time()
[, int $usec
= 0
]] )Creates a new date. If no parameters are given, the current time is used.
sec
Number of seconds since January 1st, 1970.
usec
Microseconds.
Returns this new date.
Example #1 MongoDate::__construct() example
This example demonstrates creating a new date with the current time and a new date with a given time.
<?php
$d = new MongoDate();
echo "$d\n";
$d = new MongoDate(1234567890);
echo "$d\n";
$d = new MongoDate(strtotime("2009-05-01 00:00:01"));
echo "$d\n";
?>
以上例程的输出类似于:
0.23660600 1235685067 0.00000000 1234567890 0.00000000 1241150401