lunes, 10 de octubre de 2011

PHP - Operaciones con fechas - Sumar o Restar dias



// Obtenemos la fecha actual
$currentDate = date("Y-m-d");

// Le agregamos un dia
$date = strtotime(date("Y-m-d", strtotime($currentDate)) . " +1 day");



// Mostramos la fecha modificada
echo "Date After adding one day: ".date(
"Y-m-d", $date)."<br>";


Puedes cambiar el +1day por -20 day, +3 week, -7 month, etc.. 


;)



No hay comentarios:

Publicar un comentario