Sorry if Duplicate But could not Find anything Similar that can help me.
I am using datetime picker
And I am trying to calculate a date range based on Day + time
Till now I came with this In JS
$('#calculate').click(function(event){
event.preventDefault();
var darrival = $('#darrival').val();
var rdate = $('#rdate').val();
var start = new Date(darrival);
var end= new Date(rdate);
var finaltime=(end-start)/1000/60/60;
alert(finaltime);
});
But I am getting NaN. I made
console.log(start)
And it show up "Invalid Date"
The value that I am taking(var darrival = $('#darrival').val();
)
Look like: 26-08-2013 01:08
I guess new Date doesnt count the time can anybody suggest something? thank you forrward.