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
What is a query give example?
What is the capacity of mysql database?
What is the use of trim function in php?
What is cURL in PHP?
Tell me how can I display text with a php script?
Which function(s) in PHP computes the difference of arrays?
Steps for the payment gateway processing?
Is key in array php?
What is difference between strstr() and stristr() in PHP?
What is php beginner?
What is php form validation?
How can php and javascript interact?
What is PHP's configuration file called?
How to remove values saved in the current session?
What is "echo" in php?