Exemple #1
0
 /**
  * Creates a range of dates that starts at the current date and goes forward 
  * or backward the specified number of days.
  *
  * @param string $days the length of the range in days
  * @param string $forward the direction of the range i.e. forward/previous.
  */
 public static function range($days, $forward = true)
 {
     $dates = array();
     if ($forward) {
         for ($delta = 1; $delta <= $days; $delta++) {
             $dates[] = DateUtil::add($delta);
         }
     } else {
         for ($delta = $days; $delta >= 0; $delta--) {
             $dates[] = DateUtil::subtract($delta);
         }
     }
 }