Forums

This topic is locked

How to get the time different via javascript

Posted 04 Jul 2003 14:42:56
1
has voted
04 Jul 2003 14:42:56 kaz noble posted:
hi, see code below:

function duration()
{
var endtime = new Date(requestform.endtime1.value);
var time = endtime.getHours();
var startime = new Date(requestform.starttime1.value);
var hours = (startime.getTime() - endtime.getTime())/3600;
var minutes = ((startime.getTime() - endtime.getTime()) % 3600) /60;
requestform.duration1.value = hours + ":" + minutes;
// requestform.duration1.value = endtime
}

couldn't get it work? can you help?

Reply to this topic