note 109846 added to class.dateperiod
| From: | josh dot love at verizon dot net | Date: | Mon, 27 Aug 2012 14:23:12 +0000 |
| Subject: | note 109846 added to class.dateperiod | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190235@lists.php.net to get a copy of this message | ||
Just an example to include the end date using the DateTime method 'modify'
<?php
$begin = new DateTime( '2012-08-01' );
$end = new DateTime( '2012-08-31' );
$end = $end->modify( '+1 day' );
$interval = new DateInterval('P1D');
$daterange = new DatePeriod($begin, $interval ,$end);
foreach($daterange as $date){
echo $date->format("Ymd") . "<br>";
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 167.212.7.1
----
Manual Page -- http://www.php.net/manual/en/class.dateperiod.php
Edit -- https://master.php.net/note/edit/109846
Del: integrated -- https://master.php.net/note/delete/109846/integrated
Del: useless -- https://master.php.net/note/delete/109846/useless
Del: bad code -- https://master.php.net/note/delete/109846/bad+code
Del: spam -- https://master.php.net/note/delete/109846/spam
Del: non-english -- https://master.php.net/note/delete/109846/non-english
Del: in docs -- https://master.php.net/note/delete/109846/in+docs
Del: other reasons-- https://master.php.net/note/delete/109846
Reject -- https://master.php.net/note/reject/109846
Search -- https://master.php.net/manage/user-notes.php