at first i'm using
datediff('d', a.due_date, current_date);
but it takes too long to get the result
but how can i subtract the current_date - a.due_date
and still get the same result like when i use datediff?
thank you



at first i'm using datediff('d', a.due_date, current_date); but it takes too long t..

Answer / sudhanshu_kmr


for getting date difference you can use it.......

select to_days(now())- to_days(date);


for example-


SELECT TO_DAYS(NOW())- TO_DAYS('2010-12-01');




TO_DAYS(DATE) command return a number which is total no. of
days between '0000-01-01' and the given date.




Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More MySQL Interview Questions

How can we store binary data in mysql?

2 Answers   HP,


How to check server status with 'mysqladmin'?

0 Answers  


How to show table names with 'mysqlshow'?

0 Answers  


What is the use of mysqli_fetch_array?

0 Answers  


Is mysql port 3306 tcp or udp?

0 Answers  






How to update a root password.

0 Answers  


What is the difference between GROUP BY and ORDER BY in Sql?

12 Answers   Creative, Renault Nissan, Trikon Networks,


Why do we use group by and order by function in mysql?

0 Answers  


How do I find the size of a mysql database?

0 Answers  


if we want to load data from a text file into a mysql table, but the columns in table are 1st: code(int) and 2nd: city(varchar), but in text file the format is 1st cityname and then code separeted by delimeters. how to load?

2 Answers  


What is mysql and mysqli?

0 Answers  


What data type is money?

0 Answers  


Categories