PHP date_time_set() Functie
Voorbeeld
De tijd instellen:
<?php
$date=date_create("2013-05-01");
date_time_set($date,13,24);
echo date_format($date,"Y-m-d H:i:s");
?>
Definitie en gebruik
De functie date_time_set() stelt de tijd in.
Syntaxis
date_time_set(object, hour, minute, second, microseconds)
Parameterwaarden
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
Winstwaarde: | Retourneert een DateTime-object bij succes. ONWAAR bij fout |
---|---|
PHP-versie: | 5.2+ |
PHP-wijzigingslogboek: | PHP 7.1: parameter microseconden toegevoegd PHP 5.3: de retourwaarde gewijzigd van NULL in DateTime |
❮ PHP Datum/Tijd Referentie