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

How many escape sequences are recognized in double-quoted strings?

1013


What is c++ polymorphism?

971


Is php a web server?

995


What is singleton design pattern in php?

1000


How big is nvarchar max?

1016


How to get best php developer Experience in Php with Sugar CRM / VTiger.

4413


What is composer install?

1063


What is difference Between PHP 5 and 7?

1121


Will react hooks replace redux?

973


Name some of the functions in php.

1013


What is session in PHP. How to remove data from a session?

980


Differentiate between php5 and php7?

1084


How to create a table using php?

1083


What is difference between sql and php?

1075


How break and continue while loop in php?

954