function calendar_get_date_range

6.x calendar.module calendar_get_date_range($first, $last, $step = '+1 day', $output_format = 'Y-m-d')

Creating date collection between two dates

<code> <?php # Example 1 date_range("2014-01-01", "2014-01-20", "+1 day", "m/d/Y");

# Example 2. you can use even time date_range("01:00:00", "23:00:00", "+1 hour", "H:i:s"); </code>

@author Ali OYGUR <alioygur@gmail.com>

Parameters

string since any date, time or datetime format:

string until any date, time or datetime format:

string step:

string date of output format:

Return value

array

1 call to calendar_get_date_range()
calendar_build_custom_calendar in modules/calendar/calendar.module
Actually renders the HTML for the calendar.

File

modules/calendar/calendar.module, line 3152

Code

function calendar_get_date_range($first, $last, $step = '+1 day', $output_format = 'Y-m-d') {

  $dates = array();
  $current = strtotime($first);
  $last = strtotime($last);

  while ($current <= $last) {

    $dates [] = date($output_format, $current);
    $current = strtotime($step, $current);
  }

  return $dates;
}