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

Answer Posted / savvy

"The function expects to be given a string containing a US
English date format and will try to parse that format into a
Unix timestamp (the number of seconds since January 1 1970
00:00:00 GMT), relative to the timestamp given in now, or
the current time if none is supplied." --- in php.net So Be
careful when calculating with strtotime(). Therefore in the
above ans it might be like this way
$date1 = date('M-d-Y');
$date2 = "August-07-2007";

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are psrs?

508


Which is a perfect example of runtime polymorphism?

537


What is difference between mysql_connect and mysqli_connect?

511


What is html used for?

561


What are the main error types in php and how do they differ?

842






What is difference between get and post in php?

618


What is php beginner?

511


What is helper library?

520


What is $_ get and $_ post in php?

530


How to access a specific character in a string?

504


What is php routing?

518


Explain php parameterized functions.

565


Does php support multiple inheritances?

534


Can I use php in visual studio?

537


What are sql functions?

542