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
Is apache needed for php?
What are the array functions in php?
How values in arrays are indexed?
What is slim framework?
What is the purpose of a query?
Which database is best for php?
What is the expansion of LAMP?
Does wordpress run on php 7?
How do you check if a variable has not been set in php?
How can you propagate a session id?
Explain what is the use of "echo" in php?
Tell me what is the use of explode() function?
Write a program to find no of days between two dates in php?
What is in a cookie?
Is php used anymore?