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 MySQL?

Answer Posted / sergii

DATEDIFF(expr1,expr2)

DATEDIFF() returns expr1 – expr2 expressed as a value in
days from one date to the other. expr1 and expr2 are date
or date-and-time expressions. Only the date parts of the
values are used in the calculation.

mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');
-> 1
mysql> SELECT DATEDIFF('1997-11-30 23:59:59','1997-12-31');
-> -31

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to declare variable in mysql trigger?

926


What are date and time functions in mysql?

960


Which is better mysql or mssql?

861


Does uninstalling mysql delete database?

946


What is mysql and how it works?

880


What are the objects can be created using CREATE statement?

944


What is the data type for image?

1007


How to insert html code into mysql database using php?

995


What is data type for image in mysql?

825


What is mysql server?

997


How do I save in mysql?

906


What is the return type of mysqli_query?

804


How do I completely remove mysql from windows?

913


How to enter numeric values as hex numbers?

929


Explain timestamp?

922