Posted By

3k- on 07/20/09


Tagged

dates


Versions (?)

Looping through dates


 / Published in: PHP
 

URL: http://www.v7n.com/forums/coding-forum/79591-php-loop-through-dates.html

  1. $start_date = '2008-03-01';
  2. $check_date = $start_date;
  3. $end_date = '2008-03-14';
  4.  
  5. $i = 0;
  6.  
  7. while ($check_date != $end_date) {
  8. $check_date = date ("Y-m-d", strtotime ("+1 day", strtotime($check_date)));
  9. echo $check_date . '<br>';
  10.  
  11. $i++;
  12. if ($i > 31) { die ('Error!'); }
  13. }

Report this snippet  

You need to login to post a comment.