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
Explain me what is the use of header() function in php?
Define metaphone()?
How can you retrieve a cookie value?
What does nan stand for computer science?
Explain about getters and setters in php?
How to make database connection in php?
Tell me what is use of in_array() function in php?
Can we extend two classes in php?
Is variable name casesensitive in php?
Can we learn php without html?
What is the difference between $name and $$name?
How to create a table using php?
What is the difference between get & post ?
How to access standard error stream in PHP?
Why die is used in php?