Doc #55799 [Opn->Wfx]: DateTime::setISODate allows weeks to overflow in the next year

From: Date: Sun, 04 Dec 2011 00:53:44 +0000
Subject: Doc #55799 [Opn->Wfx]: DateTime::setISODate allows weeks to overflow in the next year
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7537@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55799&edit=1 ID: 55799 Updated by: frozenfire@php.net Reported by: paul dot borgermans at gmail dot com Summary: DateTime::setISODate allows weeks to overflow in the next year -Status: Open +Status: Wont fix Type: Documentation Problem Package: Date/time related Operating System: Ubuntu / Mac OSX PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: It's implied in the Date Formats (http://php.net/manual/en/datetime.formats.date.php) that dates overflow. It doesn't specifically indicate weeks, but it does show examples for days and months. I don't feel it's worth mentioning this specifically for weeks. Previous Comments: ------------------------------------------------------------------------ [2011-09-27 13:01:04] paul dot borgermans at gmail dot com Description: ------------ This is actually a nice feature for calender data/time operations, but not documented yet: Specifying a week number larger than valid for the year, the end results nicely overflows into the next year. Test script: --------------- <?php echo date( ’W’, strtotime( "December 28th, 2011" ) ), "\n"; $ndate = new DateTime(); $ndate->setISODate(2011,56,07); echo "ndate: " . $ndate->format('Y-m-d') . "\n"; $ndate->setISODate(2012,04,07); echo "ndate: " . $ndate->format('Y-m-d') . "\n"; ?> Expected result: ---------------- 52 ndate: 2012-01-29 ndate: 2012-01-29 Actual result: -------------- 52 ndate: 2012-01-29 ndate: 2012-01-29 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55799&edit=1

« previous php.doc.bugs (#7537) next »