I have been going through my error logs and I have a date_format() error, and have looked into it and it seemed it was all about adding new DateTime to help, but it made the problem worse.
This is what I had originally -
echo "<td width='80' class='tableData'>".date_format($data['Contract_Start'], 'd/m/y')."</td>";
And this is the error I get as a result - PHP Warning: date_format() expects parameter 1 to be DateTime, null given in
So I looked into it to resolve this issue and tried below
$date1 = new DateTime($data['Contract_Start']);
echo "<td width='80' class='tableData'>".$date1->format($data['Contract_Start'], 'd/m/y'). "";"</td>";
But then I get a fatal error as below, so its made it worse.
Fatal error: Uncaught exception ‘Exception’ with message ‘DateTime::__construct() expects parameter 1 to be string, object given’ in \CSFFILES11\WEBSITES\live\new_checksafetyfirst\en\csfintranet\contracts.php:903 Stack trace: #0 \CSFFILES11\WEBSITES\live\new_checksafetyfirst\en\csfintranet\contracts.php(903): DateTime->__construct(Object(DateTime)) #1 {main} thrown in
Any ideas