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 age a variable in research?
What is session cookies php?
What is the main difference between php 4 and php 5?
What is use of header() function in php?
What is php built on?
Why does php start with variables?
Why do we need abstract class in php?
What is htaccess in php?
How to assigning a new character in a string using php?
Which is correct about mysqli and pdo?
What is the use of strip_tags() method?
Does php 5 support exceptions?
What are the special characters you need to escape in single-quoted stings?
where do we use htaccess?
Explain the importance of the function htmlentities.