Skip to content

Instantly share code, notes, and snippets.

@jeremymcminn
Created February 13, 2014 14:42
Show Gist options
  • Select an option

  • Save jeremymcminn/8976197 to your computer and use it in GitHub Desktop.

Select an option

Save jeremymcminn/8976197 to your computer and use it in GitHub Desktop.
<?php
$begin = new DateTime('now');
$beginformat = $begin->format("Y-m-d");
$beginfinal = strtotime($beginformat);
$end = $begin->modify("+90 day");
$endformat = $end->format("Y-m-d");
$endfinal = strtotime($endformat);
$dates = array();
$rootPath = 'http://' .$_SERVER['HTTP_HOST'];
$bookingDateValue = '/be/booking-search?field_booking_date_value%5Bvalue%5D%5Bdate%5D=';
$morningSlot = '&amp;field_timeslot_category_tid%5B%5D=9';
$afternoonSlot = '&amp;field_timeslot_category_tid%5B%5D=10';
$eveningSlot = '&amp;field_timeslot_category_tid%5B%5D=11';
for ($i=$beginfinal; $i<=$endfinal; $i+=86400) {
$date = date("Y-m-d", $i);
$dates[] = array("date" => $date, "url" => $rootPath . $bookingDateValue . $date . $morningSlot . $afternoonSlot . $eveningSlot );
}
$dates = json_encode($dates);
print_r($dates);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment