Okay, so I wrote some PHP functions, to filter out what you demand.
To compare dates in php it is easiest to convert them to Unix time. That's what the first function does. Unix time is the time elapsed in seconds since January 1st, 1970. Converting them gives the advantage you can simply use < and > operators to compare two times.
The next function (nowBetween), looks if the current time is between the two times given through ($start and $end).
Then I took your JSON string (as we didn't really get to see the XML source when I wrote this post) and converted it to PHP arrays. We can be sure it are arrays, as the second parameter in json_decode is set to true.
Last but not least, I loop through all bookings in the "data" section of your JSON content, read the GMTStart and GMTEnd times and check if the current time is between them using our function. If not so, then I remove the booking from the $bookings array.
The result is only the bookings with the correct times stay. My output now was empty, but that's because your bookings date from 2014-05-09... When I adapted the time it worked.
I hope this answer suits your needs.
function convertDateTime($datetime) {
//FORMAT IS date("YYYY-MM-DDThh:mm:ss")
$datetime = str_replace("T"," ",$datetime);
return date("U",strtotime($datetime));
}
function nowBetween($start,$end) {
$now = gmdate("U");
$start = convertDateTime($start);
$end = convertDateTime($end);
if ($start <= $now && $end > $now)
{
return true;
}
else
{
return false;
}
}
$bookings = '{"Bookings":{"Data":[{"BookingDate":["2014-05-09T00:00:00"],"RoomDescription":["Room06"],"TimeEventStart":["2014-05-09T14:00:00"],"TimeEventEnd":["2014-05-09T14:30:00"],"EventName":["Jake Long"],"SetupTypeDescription":["(none)"],"ReservationID":["137"],"OpenTime":["1900-01-01T00:00:00"],"CloseTime":["1900-01-01T00:00:00"],"EventTypeDescription":[[]],"BookingID":["709"],"TimeBookingStart":["2014-05-09T14:00:00"],"TimeBookingEnd":["2014-05-09T14:30:00"],"GMTStartTime":["2014-05-09T18:00:00"],"GMTEndTime":["2014-05-09T18:30:00"],"TimeZone":["ET"],"RoomCode":["R06"],"Room":["Room 6"],"RoomID":["34"],"StatusID":["3"],"EventTypeID":["0"],"DateAdded":["2014-05-09T13:47:29.087"],"DateChanged":["2014-05-09T13:47:29.087"],"ChangedBy":["Admin"]},{"BookingDate":["2014-05-09T00:00:00"],"RoomDescription":["Room06"],"TimeEventStart":["2014-05-09T18:00:00"],"TimeEventEnd":["2014-05-09T20:00:00"],"EventName":["Rob Brown"],"SetupTypeDescription":["(none)"],"ReservationID":["142"],"OpenTime":["1900-01-01T00:00:00"],"CloseTime":["1900-01-01T00:00:00"],"EventTypeDescription":[[]],"BookingID":["714"],"TimeBookingStart":["2014-05-09T18:00:00"],"TimeBookingEnd":["2014-05-09T20:00:00"],"GMTStartTime":["2014-05-09T22:00:00"],"GMTEndTime":["2014-05-10T00:00:00"],"TimeZone":["ET"],"RoomCode":["R06"],"Room":["Room 6"],"RoomID":["34"],"StatusID":["3"],"EventTypeID":["0"],"DateAdded":["2014-05-09T14:58:55.71"],"DateChanged":["2014-05-09T14:58:55.71"],"ChangedBy":["Admin"]},{"BookingDate":["2014-05-9T00:00:00"],"StartBookingDate":["2014-05-09T00:00:00"],"RoomDescription":["Room06"],"TimeEventStart":["2014-05-09T11:00:00"],"TimeEventEnd":["2014-05-09T12:00:00"],"EventName":["Jimmy James"],"SetupTypeDescription":["(none)"],"ReservationID":["141"],"OpenTime":["1900-01-01T00:00:00"],"CloseTime":["1900-01-01T00:00:00"],"EventTypeDescription":[[]],"BookingID":["713"],"TimeBookingStart":["2014-05-09T11:00:00"],"TimeBookingEnd":["2014-05-09T12:00:00"],"GMTStartTime":["2014-05-09T15:00:00"],"GMTEndTime":["2014-05-09T16:00:00"],"TimeZone":["ET"],"RoomCode":["R06"],"Room":["Room 6"],"RoomID":["34"],"StatusID":["1"],"EventTypeID":["0"],"DateAdded":["2014-05-09T14:58:15.17"],"DateChanged":["2014-05-09T14:58:15.17"],"ChangedBy":["Admin"]}]}}';
$bookings = json_decode($bookings,true);
foreach ($bookings["Bookings"]["Data"] as $index=>$arrContent)
{
if (!nowBetween($arrContent["GMTStartTime"][0],$arrContent["GMTEndTime"][0]))
{
unset($bookings["Bookings"]["Data"][$index]);
}
}