<?
function addDayIntoDate($date,$days) {
$thisyear = substr ( $date, 0, 4 );
$thismonth = substr ( $date, 4, 2 );
$thisday = substr ( $date, 6, 2 );
$nextdate = mktime ( 0, 0, 0, $thismonth, $thisday + $days, $thisyear );
return strftime("%Y%m%d", $nextdate);
}
function subDayIntoDate($date,$days) {
$thisyear = substr ( $date, 0, 4 );
$thismonth = substr ( $date, 4, 2 );
$thisday = substr ( $date, 6, 2 );
$nextdate = mktime ( 0, 0, 0, $thismonth, $thisday - $days, $thisyear );
return strftime("%Y%m%d", $nextdate);
}
$date = date("Ymd");
print $date."<br>";
$nextdate = addDayIntoDate($date,15); // Adiciona 15 dias
print $nextdate."<br>";
$backdate = subDayIntoDate($date,30); // Subtrair 30 dias
print $backdate."<br>";
?>