PHP - Funktion date_date_set()
Beispiel
Geben Sie ein neues DateTime-Objekt zurück, legen Sie ein neues Datum fest und formatieren Sie dann das Datum:
<?php
$date=date_create();
date_date_set($date,2020,10,30);
echo date_format($date,"Y/m/d");
?>
Definition und Verwendung
Die Funktion date_date_set() setzt ein neues Datum.
Syntax
date_date_set(object, year, month, day)
Parameterwerte
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
year | Required. Specifies the year of the date |
month | Required. Specifies the month of the date |
day | Required. Specifies the day of the date |
Technische Details
Rückgabewert: | Gibt bei Erfolg ein neues DateTime-Objekt zurück. FALSE bei Fehler |
---|---|
PHP-Version: | 5.2+ |
PHP-Änderungsprotokoll: | PHP 5.3: Der Rückgabewert wurde von NULL auf DateTime geändert (bei Erfolg) |
❮ PHP-Datums-/Zeitreferenz