PHP Doku:: Creates a new date. - mongodate.construct.html

Verlauf / Chronik / History: (3) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenMongoDB Native DriverTypesThe MongoDate classMongoDate::__construct

Ein Service von Reinhard Neidl - Webprogrammierung.

The MongoDate class

<<The MongoDate class

MongoDate::__toString>>

MongoDate::__construct

(PECL mongo >= 0.8.1)

MongoDate::__constructCreates a new date.

Beschreibung

MongoDate::__construct ([ long $sec [, long $usec ]] )

Creates a new date. If no parameters are given, the current time is used.

Parameter-Liste

sec

Number of seconds since January 1st, 1970.

usec

Microseconds.

Rückgabewerte

Returns this new date.

Beispiele

Beispiel #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";

?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

0.23660600 1235685067
0.00000000 1234567890
0.00000000 1241150401

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)