PHP - Funktion date_time_set()
Beispiel
Uhrzeit einstellen:
<?php
$date=date_create("2013-05-01");
date_time_set($date,13,24);
echo date_format($date,"Y-m-d H:i:s");
?>
Definition und Verwendung
Die Funktion date_time_set() stellt die Zeit ein.
Syntax
date_time_set(object, hour, minute, second, microseconds)
Parameterwerte
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
hour | Required. Specifies the hour of the time |
minute | Required. Specifies the minute of the time |
second | Optional. Specifies the second of the time. Default is 0 |
microseconds | Optional. Specifies the microsecond of the time. Default is 0 |
Technische Details
Rückgabewert: | Gibt bei Erfolg ein DateTime-Objekt zurück. FALSE bei Fehler |
---|---|
PHP-Version: | 5.2+ |
PHP-Änderungsprotokoll: | PHP 7.1: Mikrosekunden - Parameter hinzugefügt PHP 5.3: Rückgabewert von NULL auf DateTime geändert |
❮ PHP-Datums-/Zeitreferenz