datetime - Difference between 2 hours Jquery -


hy ! found script project of http://jsfiddle.net/diode/nuv7t/5/ it's make difference betweeen 2 hours need define these 2 vars

var start_actual_time  =  "01/17/2012 11:20"; var end_actual_time    =  "01/18/2012 12:25"; 

like :

var start_actual_time  =  "input#start"; var end_actual_time    =  "input#end"; 

and difference write new input #result

here try: http://jsfiddle.net/umwxw/

if can me, thank you.

demo --> http://jsfiddle.net/umwxw/1/

var start_actual_time = $("#start").val(); var end_actual_time = $("#end").val();  start_actual_time = new date(start_actual_time); end_actual_time = new date(end_actual_time);  var diff = end_actual_time - start_actual_time;  var diffseconds = diff / 1000; var hh = math.floor(diffseconds / 3600); var mm = math.floor(diffseconds % 3600) / 60;  var formatted = ((hh < 10) ? ("0" + hh) : hh) + ":" + ((mm < 10) ? ("0" + mm) : mm) $('#result').val(formatted); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -