Funkce PHP date_date_set().
Příklad
Vraťte nový objekt DateTime, nastavte nové datum a poté naformátujte datum:
<?php
$date=date_create();
date_date_set($date,2020,10,30);
echo date_format($date,"Y/m/d");
?>
Definice a použití
Funkce date_date_set() nastavuje nové datum.
Syntax
date_date_set(object, year, month, day)
Hodnoty parametrů
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 |
Technické údaje
Návratová hodnota: | Při úspěchu vrátí nový objekt DateTime. NEPRAVDA při selhání |
---|---|
Verze PHP: | 5,2+ |
PHP Changelog: | PHP 5.3: Návratová hodnota byla změněna z NULL na DateTime (při úspěchu) |
❮ Reference data/času PHP