Time Difference In JQuery
I need to subtract two 24-hour time values from 0 to 23 using JQuery. e.g. , 01:00 - 03:00 should return 22:00 hours but my function's not working function TimeDiff() { var st
Solution 1:
check this demo please, i wrote a demo for you, you can use it;
Solution 2:
var diff =
new Date( '01/01/2009 ' + $('#fTime').val()) -
new Date( '01/01/2009 ' + "03:00 PM" );
var hours=(diff / 1000)+"";//just to make it a string
use hours+":00"
for outputs like "22:00" hrs
Also, find the time format should have a AM/PM
Post a Comment for "Time Difference In JQuery"