I am converting a string number to strtotime
and then attempting to get a written date outputted. This is working to an extent but the issue is that the dates are wrong.
THE PHP
$today = date("Y-m-d");
function dateRange($start, $end) {
date_default_timezone_set('UTC');
$diff = strtotime($end) - strtotime($start);
$daysBetween = floor($diff/(60*60*24));
$formattedDates = array();
for ($i = 0; $i <= $daysBetween; $i++) {
// $tmpDate = date('Y-m-d', strtotime($start . " + $i days"));
$tmpDate = date('Y-m-d', strtotime($start . " + $i days"));
// $formattedDates[] = date('Y-m-d', strtotime($tmpDate));
$formattedDates[] = date('Y-m-d', strtotime($tmpDate));
}
return $formattedDates;
}
$start=$date_system_installed;
$end=$today;
$formattedDates = dateRange($start, $end);
foreach ($formattedDates as $dt)
{
$date = strtotime($dt);
echo date('l jS F Y',$date);
}
The outputted dates
The true dates that should be showing but in text
Where am i going wrong for this to output the correct format but incorrect dates?