Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/03/2008, 07:59
Avatar de farra
farra
 
Fecha de Ingreso: marzo-2008
Ubicación: Aqui estoy
Mensajes: 574
Antigüedad: 17 años
Puntos: 20
Re: manipulacion de Fecha+PHP

ahi un codigo listo para funcionar con el formulario y todo...

Código PHP:
<?php
$Fecha
=htmlentities($_GET['fecha']);
if(
$Fecha != ""){
    
$dia=date("d"strtotime($Fecha));
    
$mes=date("m"strtotime($Fecha));
    
$ano=date("Y"strtotime($Fecha));
    
$diasasumar=htmlentities($_GET['diasum']);
    
$fechaprox mktime(000$mes  $dia+$diasasumar$ano);
    
$fechagenerada strftime("%Y-%m-%d",$fechaprox);
}
?>
<form name="form1" method="GET" action=""><p>Fecha: 
  <label>
  <input type="text" name="fecha" id="fecha" value="2008-02-29">
  </label>
  <br />
</p>

  <label>
  Dias a Sumar:
  <input name="diasum" type="text" id="diasum" value="1" size="3" maxlength="3">
  </label>
  <label>
  <input type="submit" name="button" id="button" value="Genera Fecha">
  </label>
</form><br />
<p>Fecha Generada: <?php echo $fechagenerada ?> </p>