title: How to get opening hours from google places api
body: <p>Here I have a code that works fine, so here is simple google places code that show me a places based on location and I add an label on every marker so:</p>
  
  <p><a href="http://jsbin.com/UqafeCI/4/edit" rel="noreferrer">http://jsbin.com/UqafeCI/4/edit</a> - CODE and DEMO</p>
  
  <p>Now I want to in label show opening time so I add to my code:</p>
  
  <pre><code>if (!!place.opening_hours.periods[1].open.time) open = place.opening_hours.periods[1].open.time;
  </code></pre>
  
  <p>and now my code looks like this:</p>
  
  <pre><code>google.maps.event.addListener(searchBox, 'places_changed', function() {
      var places = searchBox.getPlaces();
  
      for (var i = 0, marker; marker = markers[i]; i++) {
        marker.setMap(null);
      }
  
      // For each place, get the icon, place name, and location.
      markers = [];
      var bounds = new google.maps.LatLngBounds();
      for (var i = 0, place; place = places[i]; i++) {
        var image = {
          url: place.icon,
          size: new google.maps.Size(71, 71),
          origin: new google.maps.Point(0, 0),
          anchor: new google.maps.Point(17, 34),
          scaledSize: new google.maps.Size(25, 25)
        };
  
        //THIS CODE I ADD TO PREVIOUS CODE THAT WORK, so if there is open time to show in label
        var open = 'No work time';
       if (!!place.opening_hours.periods[1].open.time) open = place.opening_hours.periods[1].open.time;
  
        // Create a marker for each place.
       var marker = new MarkerWithLabel({
          map: map,
          icon: image,
          title: place.name,
          position: place.geometry.location,
         labelContent: open,
         labelClass: "labels", // the CSS class for the label
         labelStyle: {opacity: 0.75},
                labelAnchor: new google.maps.Point(22, 0)
        });
  
        markers.push(marker);
  
        bounds.extend(place.geometry.location);
      }
  
      map.fitBounds(bounds);
    });
  </code></pre>
  
  <p>So how I can show open time of an object on label if time exist???</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I try to add request and service.getDetails function but again I cant get opening_time:</p>
  
  <p>CODE:</p>
  
  <pre><code> google.maps.event.addListener(searchBox, 'places_changed', function() {
      var places = searchBox.getPlaces();
  
  
      for (var i = 0, marker; marker = markers[i]; i++) {
        marker.setMap(null);
      }
  
      // For each place, get the icon, place name, and location.
      markers = [];
      var bounds = new google.maps.LatLngBounds();
      for (var i = 0, place; place = places[i]; i++) {
        var image = {
          url: place.icon,
          size: new google.maps.Size(71, 71),
          origin: new google.maps.Point(0, 0),
          anchor: new google.maps.Point(17, 34),
          scaledSize: new google.maps.Size(25, 25)
        };
        var request =  {
            reference: place.reference
      };
        service.getDetails(request, function(place, status) {
  
        var open = null;
        try{
    open = place.opening_hours.periods[1].open.time;
  }
  catch(e){
    open='No work time';
  }
        var otvoreno = place.openNow+"&lt;/br&gt;"+place.name;
  
        // Create a marker for each place.
       var marker = new MarkerWithLabel({
          map: map,
          icon: image,
          title: place.name,
          position: place.geometry.location,
         labelContent: open,
         labelClass: "labels", // the CSS class for the label
         labelStyle: {opacity: 0.75},
                labelAnchor: new google.maps.Point(22, 0)
        });
      });
        markers.push(marker);
  
        bounds.extend(place.geometry.location);
  
      }
  
      map.fitBounds(bounds);
    });
  </code></pre>