|  | Posted by Al on 01/21/06 20:23 
Ken Robinson wrote:> Try this simple function:
 >
 > <?php
 > $date_array = date_range('10/20/2005','01/31/2006');
 > $dates = "'" . implode("','",$date_array) . "'";
 > echo $dates . "<br />\n";
 >
 > function date_range($sd,$ed)
 > {
 >    $tmp = array()
 >    $sdu = strtotime($sd);
 >    $edu = strtotime($ed);
 >    while ($sdu <= $edu) {
 >      $tmp[] = date('Y-m-d',$sdu);
 >      $sdu = strtotime('+1 day',$sdu);
 >    }
 >    return ($tmp);
 > }
 > ?>
 >
 > Ken
 
 That was my simple function :) Mine just got out of control with
 comments and stuff...
 
 As for the sql BETWEEN operator, I was thinking that too... but I'm not
 100% on sql so I was just kinda thinking "surely it has a between
 operator".
 [Back to original message] |