How can we know the number of days between two given dates
using PHP?
How can we know the number of days between two given dates
using MySQL?
Answer Posted / abdulgafoor
Using PHP
$date1 = date("Y-m-d");
$date2= "2005-5-15";
$nodays = (strtotime()-strtotime())/(60*60*24);
echo "no of days are $nodays ";
Using mySql :
mysql>SELECT DATEDIFF(NOW(),'2005-5-15');
The output will give you the exact number of days.
Is This Answer Correct ? | 12 Yes | 4 No |
Post New Answer View All Answers
Can php variables have numbers?
What is the difference between require_once and require in php?
What is the use of ajax in php?
What is user defined function in php?
What is the purpose of constant() function?
What is the difference between require and include in php?
Is php a framework?
What is full form of PHP?
What is the use of pear in php?
Which function gives us the number of affected entries by a query?
Which function would you use to merge two arrays in php?
How to write the form tag correctly for uploading files?
What is memcache?
Is set in php?
Is jquery better than javascript?