I want to know what's the way to find the difference of two date. I get the startDate and endDate from a form. Now I want to find the difference of current date and startDate or endDate.
echo $startDate = $startYear.'-'.$startMonth.'-'.$startDay.'<br>';
echo $endDate = $endYear.'-'.$endMonth.'-'.$endDay;
$_SESSION['startDate'] = $startDate;
$_SESSION['endDate'] = $endDate;
$_SESSION['team'] = $team;
header('location:test.php');
test.php
date_default_timezone_set('Asia/Kuala_Lumpur');
echo $startDate = $_SESSION['startDate'];
$date2=date_create(date('Y/m/d'));
$diff=date_diff($startDate,$date2);
echo $diff->format("%R%a days");