Tema: Sumar horas
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/06/2004, 11:02
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 3 meses
Puntos: 772
Hola, oscargil80.

Te pongo un ejemplo con una hora de entrada y otra de salida:
Código HTML:
<html>
<head>
<script>
function horas() {
	h1=new Date('01/01/2004 '+document.getElementById('HoraEntAm').value);
	h2=new Date('01/01/2004 '+document.getElementById('HoraSalAm').value);
	dif = new Date(h2-h1);
	hora = dif.getHours()-1;
	minuto = dif.getMinutes();
}
</script>
</head>
<body>
<input type="text" id="HoraEntAm" />
<input type="text" id="HoraSalAm" />
<input type="button" onclick="horas()" />
</body>
</html> 
Espero que te ayude. Saludos,