title: How to pass datetime parameter to HTTP GET message
body: <p>I want to pass two Datetime Parameter from form to WEB API from Angular JS but could not make it work. However I am able to pass only date without time to WEB API Method.</p>
  
  <p>My form DateTime controls looks like below:-</p>
  
  <p><a href="https://i.stack.imgur.com/QQjgL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QQjgL.png" alt="enter image description here"></a></p>
  
  <p>Now I want to pass Datetime like below from Angular JS:-</p>
  
  <p><strong>Angular JS Call</strong></p>
  
  <pre><code>        var startTime = $filter('date')($scope.md_invstarttime, "HH:mm");
          startTime = startTime.split(':');
          var invStartDate = new Date($scope.md_invstart);
          invStartDate.setHours(startTime[0]);
          invStartDate.setMinutes(startTime[1]);
  
          var invBookDate = $filter('date')(invStartDate, "yyyy-MM-ddTHH:mm:ss.000")
  
          var endTime = $filter('date')($scope.md_invendtime, "HH:mm");
          endTime = endTime.split(':');
          var invEndDate = new Date($scope.md_invend);
          invEndDate.setHours(endTime[0]);
          invEndDate.setMinutes(endTime[1]);
  
          var invBookEndDate = $filter('date')(invEndDate, "yyyy-MM-ddTHH:mm:ss.000")
  
          MetadataOrgFactory.getTriIdApiCall('checkinvavail', invBookDate, invBookEndDate, $scope.md_invid,       
              function (dataSuccess) {                
              }, function (dataError) {
          });
  </code></pre>
  
  <p><strong>Controller Method</strong></p>
  
  <pre><code> [Authorize]
          [Route("api/checkinvavail/{invstarttime}/{invendtime}/{invid}")]
          [HttpGet]
          public bool GetInvAvailability(DateTime invstarttime, DateTime invendtime,Guid invid)
          {
              InventoryBLL checkInv = new InventoryBLL();
              bool isAvailable = checkInv.IsAvailable(invstarttime, invendtime,invid)
              return isAvailable;
          }
  </code></pre>
  
  <p>I have searched many articles but none could solve my problem and hence this post. It would be really helpful if any one post the exact solution to this problem.</p>