Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
By this query i am getting the output as 2 days, but i need output as 3 days, please help

SELECT DATEDIFF('2014-03-03 23:59:59','2014-03-01') as Days;
Posted
Comments
Ankur\m/ 4-Mar-14 0:46am    
+1. Simple Maths!
[no name] 4-Mar-14 0:52am    
there is no query to find days
Ankur\m/ 4-Mar-14 1:00am    
I am sorry I do not know MySQL but does this not work -
SELECT (DATEDIFF('2014-03-03 23:59:59','2014-03-01') + 1) as Days;
[no name] 4-Mar-14 1:04am    
But i got the answer just adding 1 according to u :) thanks :)
Ankur\m/ 4-Mar-14 1:05am    
You are welcome! Glad to help. :)

1 solution

Either add +1 to the result or change the first part of the date 2014-03-03 23:59:59 to 2014-03-04 00:00:00.
It is simple Mathematics, isn't it? :)
 
Share this answer
 
Comments
[no name] 4-Mar-14 0:58am    
Ankur u r right i need to add always 1 to my result ... :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900