Jump to content

How do I calculate the dates between two dates?


ajmcello

Recommended Posts

You need to convert the dates to unix timestamps and use those in a for loop:
[code]<?php
$date1 = '11/25/06';
$date2 = '12/04/06';
$start = strtotime($date1);
$end = strtotime($date2);
while ($start <= $end) {
      echo date('m/d/y',$start),'<br>';
      $start += 86400; // 86400 seconds in a day
}
?>[/code]

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.