PHP date_date_set() Functie
Voorbeeld
Retourneer een nieuw DateTime-object, stel een nieuwe datum in en maak vervolgens de datum op:
<?php
$date=date_create();
date_date_set($date,2020,10,30);
echo date_format($date,"Y/m/d");
?>
Definitie en gebruik
De functie date_date_set() stelt een nieuwe datum in.
Syntaxis
date_date_set(object, year, month, day)
Parameterwaarden
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
Winstwaarde: | Retourneert een nieuw DateTime-object bij succes. ONWAAR bij fout |
---|---|
PHP-versie: | 5.2+ |
PHP-wijzigingslogboek: | PHP 5.3: de retourwaarde is gewijzigd van NULL in DateTime (bij succes) |
❮ PHP Datum/Tijd Referentie