<?php
echo "<br>".date("Y-m-d"); // 2019-02-19
// añadimos un dia a la fecha actual del sistema
echo "<br>".date("Y-m-d", strtotime('+1 day', time())); // 2019-02-20
// añadimos tres dias a la fecha actual del sistema
echo "<br>".date("Y-m-d", strtotime('+3 day', time())); // 2019-02-22
// restamos un mes a la fecha actual
echo "<br>".date("Y-m-d", strtotime('-1 month', time())); // 2019-01-19
// añadimos un año a la fecha actual
echo "<br>".date("Y-m-d", strtotime('+1 year', time())); // 2020-02-19
// obtenemos una fecha dada
$fecha = date('2019-01-01'); // 2019-01-01
// añadimos un dia a la fecha indicada
echo "<br>".date("Y-m-d", strtotime('+1 day', strtotime($fecha))); // 2019-01-02
// añadimos tres dias a la fecha indicada
echo "<br>".date("Y-m-d", strtotime('+3 day', strtotime($fecha))); // 2019-01-04
// restamos un mes a la fecha indicada
echo "<br>".date("Y-m-d", strtotime('-1 month', strtotime($fecha))); // 2018-12-01
// añadimos un año a la fecha indicada
echo "<br>".date("Y-m-d", strtotime('+1 year', strtotime($fecha))); // 2020-01-01
Comentarios sobre la versión: 1 (1)
Hay un inconveniente, cuando la fecha es 31/05/2020 y restas un mes, te muestra 01/05/2020 y no 30/04/2020 como debería.
Gracias.
Saludos
Ruben Dario Fernandez