date

Difference between two dates in php

Get First Day from Request:
$originalDate = $_REQUEST[‘date’];
$newDate = date(“Y-m-d”, strtotime($originalDate));

Get Second Day from Request:
$endDate = $_REQUEST[‘date2’];
$toDate = date(“Y-m-d”, strtotime($endDate));

Get Difference between days:
$date_diff = (strtotime($toDate)- strtotime($newDate))/24/3600;

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *