I need to get the difference of two Date with time. I have tried to code but it doesn't work.
HTML PAGE
<div class="col-xs-3 ">
<input type="date" class="form-control" name="planeddate">
</div>
<div class="col-xs-3 ">
<input type="date" class="form-control" name="actualdate">
</div>
<div class="col-xs-3 ">
<input type="time" class="form-control" name="planedtime">
</div>
<div class="col-xs-3 ">
<input type="time" class="form-control" name="actualtime">
</div>
PHP
<?php
include "connect.php"
$con=mysqli_connect("$host", "$username", "$password","$db_name")or die("Your Connection is in error");
$planeddate=date('Y-m-d', strtotime($_POST['planeddate']));
$actualdate=date('Y-m-d', strtotime($_POST['actualdate']));
$planedtime=$_REQUEST['planedtime'];
$actualtime=$_REQUEST['actualtime'];
$diff =date_diff($actualdate,$planeddate);
echo $diff->format("%R%a days");
$time_diff = $actualtime - $planedtime;
echo $time_diff;
?>
I am not getting both date and time differences. Please help me out. And also calculate the difference for the input type "datetime-local" if possible.
<input type="datetime-local" name="datetime">