Page 1 of 1

DATE DIFF BETWEEN SELECTED DATE & CURDATE()

Posted: 2020-07-22 15:04
by jrcervantest
Request some assistance. I’m applying a calculated field to the last column (DTECALC) using the following statement to find the difference between two dates; a selected date and the current date.

SELECT DATE - CURDATE()
FROM LINKS
WHERE ID='%ID%’ 

The result seems to be working, except when it jumps to the next month the result is largely inaccurate. Does anyone know if we need to set the data type to particular value or am I missing an additional value in the SQL statement? Thank you for your assist. :D

V/r,

Re: DATE DIFF BETWEEN SELECTED DATE & CURDATE()

Posted: 2020-07-22 20:47
by jrcervantest
Found the answer for those that are interested!

SELECT DATEDIFF(date,curdate())
FROM links
WHERE id='%ID%'

Re: DATE DIFF BETWEEN SELECTED DATE & CURDATE()

Posted: 2021-02-10 19:27
by nandrew
Thanks a lot, It worked for me in a similar situation.