" . $SttDate ." " . $EndDate . "
Okay

"); //if ($EndDate<$SttDate) //{echo "

End Date needs to be the same as or later than the Start Date. Please use 'yyyy-mm-dd' format."; //} //This inserts the date variables into the Google API request $getaresponse = 'https://www.googleapis.com/calendar/v3/calendars/4fnme9rmk20odatisd2jks1pvo%40group.calendar.google.com/events?orderBy=startTime&singleEvents=true&timeMax=' . (string)$EndDate . 'T23%3A00%3A00-06%3A00&timeMin=' . (string)$SttDate . 'T03%3A00%3A00-06%3A00&key=AIzaSyBoS0tmxAzRjdXkh_G1u5yu1ONua1MEo7s'; //'T03%3A00%3A00-06%3A00" is the key for UTC time -6 hrs and needs to be adjusted for DST. Can we make it automatic. //echo ('https://www.googleapis.com/calendar/v3/calendars/4fnme9rmk20odatisd2jks1pvo%40group.calendar.google.com/events?orderBy=startTime&singleEvents=true&timeMax=' . (string)$EndDate . 'T23%3A00%3A00-05%3A00&timeMin=' . (string)$SttDate . 'T03%3A00%3A00-05%3A00&key=AIzaSyBoS0tmxAzRjdXkh_G1u5yu1ONua1MEo7s'); //echo ("

Getaresponse = ". $getaresponse . "

"); $response = file_get_contents($getaresponse); //echo ("

Response = " . $response . "

"); //The section below decodes the json response into an associative array. I have managed to work out how to populate the "array within an array" with entries for DATE format or DATETIME format. //this function should return the array within one of the results $decoded_response = json_decode($response, true); //echo ("

" . date("F j, Y", strtotime($SttDate)) . "


"); //test to strip tags from address for ($i = 0; $i < count($decoded_response["items"]); $i++) //$stripcity = strip_tags($decoded_response['items'][$i]['location']); //echo ("

Location: " . $stripcity); //echo ("

"); //echo ("


"); { //Line below was a piece of debugging code //echo "".$i . " … ".count($decoded_response["items"])."…".($decoded_response['items'][$i]['start']['date'])."
"; //This handles the two different elements of the 'start' array within the 'items' array where the start and end dates might be stored if (isset($decoded_response['items'][$i]['start']['dateTime'])) { $start_GTime = ($decoded_response['items'][$i]['start']['dateTime']); $Gdate = new DateTime($start_GTime); //echo "

" . $Gdate->format('l, F j')."

"; $end_GTime = ($decoded_response['items'][$i]['end']['dateTime']); $Gend = new DateTime($end_GTime); echo "" . $Gdate->format('g:i') . " "; $Ampm2 = ($Gend->format('a')); $Ampm1 = ($Gdate->format('a')); if($Ampm1<>$Ampm2){ echo " " . $Ampm1;} if ($Gdate<$Gend){ echo " - " . $Gend->format('g:i a') . " ";} else { echo " " . $Ampm1 . " ";} //Inserts beer mug emoji echo json_decode('"\uD83C\uDF7A"'); } if (isset($decoded_response['items'][$i]['start']['date'])) { $start_day = ($decoded_response['items'][$i]['start']['date']); $Gdate= new DateTime($start_day); //echo "

" . $Gdate->format('l, F j')."

"; } //prints out the rest of the event information echo " " . $decoded_response["items"][$i]["summary"] . "

"; echo $decoded_response["items"][$i]["location"] . " "; // stripcity test $stripcity = urlencode(strip_tags($decoded_response['items'][$i]['location'])); $shortcode=stripos($stripcity,"%26%238209"); $stripcity=substr($stripcity,0,$shortcode-4); $shortcode=strripos($stripcity,"%28"); if ($shortcode > 0) $stripcity=substr($stripcity,0,$shortcode-1); echo (""); echo json_decode('"\uD83C\uDF0E"'); echo ("
"); // echo "
"; //end stripcity echo nl2br($decoded_response["items"][$i]["description"]) . "

"; } // echo "


"; //*/ ?>