Hi all. I went through 10 pages and couldn't find anything like this, although I would have thought I would. I'm simply trying to get the difference between two times. Here's my code, any thoughts on how I can fix this would be appreciated.
<html>
<title>timesheet</title>
<head>
<script>
function addhours()
{
var shours1=document.getElementById('start1').value;
var ehours1=document.getElementById('end1').value;
var time1=new Date();
var time1a=time1.getTime(shours1);
var time1b=time1.getHours(time1a);
var time2=new Date();
var time2a=time2.getTime(ehours1);
var time2b=time1.getHours(time2a);
var diff= time2a-time1a;
document.text.hours.value=diff;
}
</script>
</head>
<body>
<form name="text">
<table>
<tr><td><br><br></td></tr>
<tr><td>Date:<input type="date" step=".5" name=""></td></tr>
<tr><td>Start time:<input type="text" id="start1" onChange="addhours()"></td><td>End time:<input type="text" id="end1" onChange="addhours()"></td><td></tr>
<tr><td>Difference:<input type="text" name="hours"></td></tr>
</body>
</html>