If you have a Google Places place_id and API key, the following URL will return the hours as a JSON object.
Just be sure to replace "YOUR_PLACE_ID" with your actual Google Places place_id and "YOUR_API_KEY" with your Google Places API key.
https://maps.googleapis.com/maps/api/place/details/json?placeid=YOUR_PLACE_ID&fields=opening_hours&key=YOUR_API_KEY
You will get hours for each day as both day-of-week-number, from 0 to 6, where Sunday = 0, as well as a standard language array. The numbered days are found in result.opening_hours.periods
and the standard language array is result.opening_hours.weekday_text
weekday_text
is simpler to use while periods
will enable you to do things like display the results in different languages.
Here is how it might look in PHP:
$url = 'https://maps.googleapis.com/maps/api/place/details/json?placeid=YOUR_PLACE_ID&fields=opening_hours&key=YOUR_API_KEY';
$hours_raw = @file_get_contents($url);
if (!empty($hours_raw)) {
$hours_json = json_decode($hours_raw, true);
if (!empty($hours_json['result']['opening_hours'])) {
$business_hours = $hours_json['result']['opening_hours']['weekday_text'];
}
}
// $business_hours is an array you can use however you like e.g.
echo '<ul>';
foreach ($business_hours as $weekday) {
echo '<li>' . $weekday . '</li>';
}
echo '</ul>';