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 age a variable in research?

861


What is session cookies php?

944


What is the main difference between php 4 and php 5?

944


What is use of header() function in php?

1000


What is php built on?

940


Why does php start with variables?

977


Why do we need abstract class in php?

916


What is htaccess in php?

1200


How to assigning a new character in a string using php?

1115


Which is correct about mysqli and pdo?

1035


What is the use of strip_tags() method?

898


Does php 5 support exceptions?

1083


What are the special characters you need to escape in single-quoted stings?

889


where do we use htaccess?

961


Explain the importance of the function htmlentities.

953