0

How to count days between two dates?

I have entered data of employees work on different date now i want to calculate no of days work done by employees with their name.

26th Jan 2017, 8:52 AM
Govind Pal
Govind Pal - avatar
2 Respuestas
+ 1
I think something like this should work SELECT DATEDIFF(STR_TO_DATE(date1, '%m/%d/%Y'),STR_TO_DATE(date2, '%m/%d/%Y')) AS DAYS FROM TABLE1 Your DATE field should have DATE or DATETIME format to be used as DATEDIFF argument correctly.
26th Jan 2017, 8:59 AM
R4xx4r
R4xx4r - avatar
0
The DATEDIFF() function returns the time between two dates. Syntax DATEDIFF(datepart,startdate,enddate) Example SELECT DATEDIFF(day,'2014-06-05','2014-08-05') AS DiffDate
3rd Feb 2017, 1:31 PM
Akwin Lopez
Akwin Lopez - avatar