so I have the following form
<html>
<body>
<form action="resp_mensaje.php" method="post">
<fieldset>
<legend> Admin:</legend>
<p><img src="owl.jpg" style="width:250px; height:150px">
<p>ID:
<input type="text" name="id" size="40" tabindex="1" autofocus="true" min="1" max="1000" value="" required>
</p>
<p>Enrollment Date:
<input type="date" name="date" size="40" tabindex="3" size="40" autofocus="true" required value="">
</p>
<center>
<button type="submit">
Calculate
</button>
</center>
</fieldset>
</form>
</body>
</html>
The submit button is supposed to show me the input info and calculate the number of days and years that have passed since the enrollment date. Any idea on how I could do the latter? I've tried doing it like so:
$initialdate = new DateTime($date1);
$currentdate= new DateTime($date2);
$difference = $initialdate->diff($currentdatel);
echo .$difference;
But I get the following error message: Recoverable fatal error: Object of class DateInterval could not be converted to string