smerny Posted November 14, 2009 Share Posted November 14, 2009 How can I get two dates and create a loop that does something like: $start = '11/1/2009'; $end = '11/15/2009'; $day = $start; while($day <= $end){ //get $day in the format of '11/1' and 'Sunday' $day ++ //or however you would add a single day? } Link to comment https://forums.phpfreaks.com/topic/181520-solved-using-dates/ Share on other sites More sharing options...
alpine Posted November 14, 2009 Share Posted November 14, 2009 <?php echo date('d/m l', strtotime('12/1/2009')); ?> Link to comment https://forums.phpfreaks.com/topic/181520-solved-using-dates/#findComment-957535 Share on other sites More sharing options...
smerny Posted November 14, 2009 Author Share Posted November 14, 2009 okay, that works good for the formatting, but how do i add a day? I tried $day = date('m/d/Y', strtotime($day)+1); but it kept looping through until the max execution time Link to comment https://forums.phpfreaks.com/topic/181520-solved-using-dates/#findComment-957547 Share on other sites More sharing options...
smerny Posted November 14, 2009 Author Share Posted November 14, 2009 $start = strtotime('11/1/2009'); $end = strtotime('11/15/2009'); $day = $start; while($day <= $end){ echo date('m/d l', $day)."<br />"; $day = strtotime('+1 day', $day); } got it Link to comment https://forums.phpfreaks.com/topic/181520-solved-using-dates/#findComment-957557 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.