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 / vipul dalwala

php
-------------------------------------------------------
$noofdays = ceil(((strtotime($endDate) - strtotime
($startDate)) / (60*60*24)))


Mysql
-------------------------------------------------------
SELECT ((UNIX_TIMESTAMP('2007-10-01') - UNIX_TIMESTAMP
('2007-09-04'))/(60*60*24)) AS dateDiff;

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what is the main difference between php 4 and php 5?

988


What is mysql_fetch_object?

1038


Differences between get and post methods?

1034


Is array function in php?

1009


Who is known as the father of php?

1131


How does php isset work?

928


Inside a php function, what param needs to be set in order to access a global variable?

962


What is difference between compile time and run time polymorphism?

1005


What are the advantages of stored procedures, triggers, indexes in php?

1028


What is the purpose of the '.myd' file extension? What do thes file contain?

981


How cookies are trported from browsers to servers?

1016


How can you retrieve a cookie value?

1069


How can you associate a variable with a session?

1014


How can we make a constant in php?

982


What is isset post?

1008