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

Is apache needed for php?

915


What are the array functions in php?

985


How values in arrays are indexed?

1059


What is slim framework?

967


What is the purpose of a query?

929


Which database is best for php?

1014


What is the expansion of LAMP?

1058


Does wordpress run on php 7?

977


How do you check if a variable has not been set in php?

925


How can you propagate a session id?

1008


Explain what is the use of "echo" in php?

1020


Tell me what is the use of explode() function?

987


Write a program to find no of days between two dates in php?

999


What is in a cookie?

971


Is php used anymore?

976