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 do I get a list of table names in mysql?

923


Can I use mysql for free?

898


How to returns the columns and column information pertaining to the designated table.

1017


Which is better sqlite or mysql?

1030


What do ddl, dml, and dcl stand for?

905


What is pdo connection?

874


Explain about reporting services of MYSQL?

1060


How can you plan the logshipping before processing?

2329


What is mysql installer?

990


How do stored procedures work?

1030


What are the advantages and disadvantages of using mysql?

997


what is constraints? Also explain the different types of constraints?

956


What is mysql command line?

1048


What does mysql_fetch_assoc do?

960


What's the difference between mysql and sql server?

980