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
How check submit button is clicked in php?
What is urlencode and urldecode in php?
What is difference between explode() or split() in PHP?
How to get the number of characters in a string?
What is the interface in php?
What are the differences between mysqli_connect and mysqli_pconnect?
What are super global variables in php?
What the limitation of header() function in php?
What is php compared to html?
What is the use of php and mysql?
How to get the http request in php?
How does the identity operator ===compare two values in PHP?
How to create a table to store files?
How to get useful error messages in php?
What is the difference between echo print and print_r in php?