abdul gafoor


{ City } bangalore
< Country > india
* Profession *
User No # 3900
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 12
Users Marked my Answers as Wrong # 4
Questions / { abdul gafoor }
Questions Answers Category Views Company eMail




Answers / { abdul gafoor }

Question { 13313 }

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

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