function duration($day, $date)
{
$date1 = $date;
//$date2 = date_create("Y/m/d");
//$date1 = date_create("Y/m/d", strtotime($date));
//echo $date1;
//echo $date2;exit;
$date1 = date_create($date);
$date2 = date_create(date('Y-m-d'));
$diff = date_diff($date1, $date2);
return $diff->format("%a");
}
I want difference between days ex. I have entered 10
days and date is 17-12-2015
than I must want 27-12-2015
so how to get it?
Hello Please try this,
$date = date_create('2000-01-01');
date_add($date, date_interval_create_from_date_string('10 days'));
echo date_format($date, 'Y-m-d');
this will help you to add number of days, month etc to date.
Thanks Amit
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.