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 do I run a php script in windows?
How do I end a php session?
Write a program to swap two numbers using php.
When sessions ends?
What is substr in php?
What is php default argument?
How does session work in php?
How long is a php session valid?
Explain what is the static variable in function useful for?
List few sensible functions in PHP?
Why die is used in php?
How do I install php?
How to check curl is enabled or not in PHP
Are php sessions cookies?
Why should I store logs in a database rather than a file?