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

What is regex in mysql?

1064


What language is mysql written in?

971


What is mysqli_connect_error ()?

1004


How do I stop a mysql service?

985


What is cursor in mysql?

875


What are the differences between innodb and myisam engines?

965


How do I create a mysql username and password?

879


What is strict mode in mysql?

885


How do I copy a table in mysql workbench?

858


What is normalization and list the different types of normalization?

936


How to display top 50 rows?

1041


How do you shutdown a mysql database?

1026


how you will show all records not containing the name "sonia" and the phone number '9876543210' order by the phone_number field.

894


What is unique key in mysql?

963


Can a table have multiple primary keys?

880