The date_add() function is mainly used for adding some days, months, years, hours, minutes, and seconds to a date.
Syntax of date_add()
date_add(object,interval);
you can take belloe example for better understanding:
<?php
//here define a date variable
$date=date_create("2015-08-01");
//here call date_add function and define interval days and months
date_add($date,date_interval_create_from_date_string("30 days"));
//print date format
echo date_format($date,"Y-m-d");
?>
output will come following:
2015-08-31
0 Comment(s)