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;

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

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 *