Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/12/2008, 11:17
jetzona
 
Fecha de Ingreso: marzo-2006
Mensajes: 202
Antigüedad: 18 años, 1 mes
Puntos: 2
Respuesta: convertir de texto a horas.

miren hago esto pero el resultado no esta bien:

<?php
$thrs_p1 = "16";
$tmin_p1 = "47";
$thrs_p2 = "4";
$tmin_p2 = "29";
$hora1 = date("G:i",mktime($thrs_p1,$tmin_p1,0));
$hora2 = date("G:i",mktime($thrs_p2,$tmin_p2,0));
$hora_final = date("G:i",$hora1 + $hora2);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
<p>
<input name="textfield" type="text" value="<?php echo $hora1 ?>">
</p>
<p>
<input name="textfield2" type="text" id="textfield2" value="<?php echo $hora2 ?>">
</p>
<p> <input name="txt1" type="text" id="txt1" value="<?php echo $hora_final ?>">
</p>
</body>
</html>



pero de resultado en $hora_final me da las 20:00, y no las 21:16 como corresponde, alguna sugerencia.......?????
me estara solo sumando las horas????