Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How check submit button is clicked in php?

1016


What is urlencode and urldecode in php?

1116


What is difference between explode() or split() in PHP?

942


How to get the number of characters in a string?

1021


What is the interface in php?

1018


What are the differences between mysqli_connect and mysqli_pconnect?

1002


What are super global variables in php?

1028


What the limitation of header() function in php?

952


What is php compared to html?

965


What is the use of php and mysql?

1021


How to get the http request in php?

985


How does the identity operator ===compare two values in PHP?

1077


How to create a table to store files?

1094


How to get useful error messages in php?

1048


What is the difference between echo print and print_r in php?

989