$fecha = date('Y-m-j');
$newfecha = strtotime ( '+2 day' , strtotime ( $fecha ) );
$newfecha = date ( 'Y-m-j' , $newfecha );
Para sumar horas a una fecha:
$fecha = date('Y-m-d H,i,s', (strtotime ("+2 Hours")));
También se pueden sumar y restar semanas, meses y años:
$newfecha = strtotime ('+1 week', strtotime($fecha));
$newfecha = strtotime ('-2 week', strtotime($fecha));
$newfecha = strtotime ('+3 month', strtotime($fecha));
$newfecha = strtotime ('-4 month', strtotime($fecha));
$newfecha = strtotime ('+5 year', strtotime($fecha));
$newfecha = strtotime ('-6 year', strtotime($fecha));

No hay comentarios:
Publicar un comentario