How can we know the number of days between two given dates
using PHP?

Answer Posted / ash

$date1 = date('Y-m-d');
$date2 = "2007-07-05";
$days = (strtotime($date1) - strtotime($date2)) / (60 * 60
* 24);
echo " No of $days difference";

Is This Answer Correct ?    25 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is session data stored?

498


What is lamp in php?

543


How to reset/destroy a cookie?

579


Tell us how can we access the data sent through the url with the post method?

523


What language is php based on?

494






Explain the installation of PHP on UNIX systems?

551


Explain me is it possible to destroy a cookie?

561


What is the meaning of php?

515


Is salary fixed or variable cost?

533


How to declare an array in php?

543


What is binary safe function in php?

578


What are the design patterns in php?

518


What is needed to be able to use image function?

528


Tell me what library is used for pdf in php?

521


What is the functionality of the functions strstr() and stristr()?

527