I am using this function to filter query results that are older than 60 days:
s.timeSubmitted >= ( CURDATE() - INTERVAL 60 DAY )
The problem is, the “60 days” part doesn’t seem to be an exact figure. I want it to filter right where s.timeSubmitted is longer than 60 days, down to the exact second of s.timeSubmitted.
How do I write “60 Days” as an exact figure (down to the second)?
The problem is that
CURDATE()returns aDATEtype, not aDATETIMEtype (an instant in time). The result of subtracting an interval from aDATEis also aDATE.Instead, try this:
This gives you what you want, because
NOW()returns aDATETIME, so the result of the subtraction is also aDATETIME.