help fix this error
Fatal error: Uncaught exception ‘Exception’ with message ‘DateTime::_construct() [datetime.–construct]: Failed to parse time string (–) at position 0 (-): Unexpected character’ in Z:\home\plati\www\view.php:110 Stack trace: #0 Z:\home\plati\www\view.php(110): DateTime->_construct(‘–‘) #1 {main} thrown in Z:\home\plati\www\view.php on line 110
$newday = $a['dayz'];
$endmonth = $a['monthz'];
$newyear = $a['yearz'];
$date = new DateTime("$newyear-$endmonth-$newday");
$date->modify('+8 day');
$year = $date->format('Y');
$month = $date->format('m');
$day = $date->format('d');
You can easily deal with the exception by catching it, this will fix the error in the sense that you don’t need to bother about that error any longer:
At least at some point you need to do error handling. Exceptions require you to do that,
DateTimethrows exceptions.