I'm using a date.js
plugin to convert my times into date object and then I'm subtracting them.But the result is not valid. My time is in this format 11:00 pm
This is what I'm doing:
var tim_i = $('#in_time').val();
var tim_o = $('#out_time').val();
total_tim = "";
if (tim_i && tim_o ){
d1 = Date.parse(tim_i);
d2 = Date.parse(tim_o);
date_diff = new Date(d2 - d1);
total_tim=date_diff.getHours() + ':' + date_diff.getMinutes();
}
$('#total_time').val(total_tim);
Is there something else I need to do?