Werbung
DateTime::setISODate
(PHP 5 >= 5.2.0)
DateTime::setISODate — Sets the ISO date
Beschreibung
Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
Parameter-Liste
- object
-
Nur bei prozeduralem Aufruf: Ein von date_create() zurückgegebens DateTime Objekt.
- year
-
Year of the date.
- week
-
Week of the date.
- day
-
Offset from the first day of the week.
Rückgabewerte
Returns the modified DateTime.
Beispiele
PHP Code
1
2
3
4
5
6
2
3
4
5
6
date_default_timezone_set('Europe/London');
$datetime = new DateTime();
// Offset from start of week 2 (7) = 5
$datetime->setISODate(2008, 2, 5); // Day 5 of week 2 of 2008 is the 11th of January.
// Offset from start of week 2 (7) = 10
$datetime->setISODate(2008, 2, 10); // Day 10 of week 2 of 2008 is the 16th of January.
PHP Code
1
2
3
2
3
date_default_timezone_set('Europe/London');
$datetime = date_create();
date_isodate_set($datetime, 2008, 6); // Week 6 of 2008 is in February.