PHP - Funktion date_isodate_set()
Beispiel
Stellen Sie das ISO-Datum auf die 5. Woche im Jahr 2013 ein:
<?php
$date=date_create();
date_isodate_set($date,2013,5);
echo date_format($date,"Y-m-d");
?>
Definition und Verwendung
Die Funktion date_isodate_set() setzt ein Datum gemäß dem ISO 8601-Standard unter Verwendung von Wochen- und Tagesoffsets (anstatt ein bestimmtes Datum zu verwenden).
Syntax
date_isodate_set(object, year, week, day)
Parameterwerte
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
year | Required. Specifies the year of the date |
week | Required. Specifies the week of the date |
day | Optional. Specifies the offset from the first day of the week. Default is 1 |
Technische Details
Rückgabewert: | Gibt bei Erfolg ein DateTime-Objekt zurück. FALSE bei Fehler |
---|---|
PHP-Version: | 5.2+ |
PHP-Änderungsprotokoll: | PHP 5.3: Rückgabewert von NULL auf DateTime geändert |
❮ PHP-Datums-/Zeitreferenz