SELECT (CURRENT_DATE - P.DataDiPrestito) AS "Sisssssss"
FROM prestito P, utente U
WHERE P.id_Utente = U.ID_Utente
So I'm subtracting by the current date the value of a date from my database to see the difference between them in days.
The problem is that, when I subtract a value that's in the same month the result is correct but when it's from a month before it's not.
Today is the 15 of May, and if subract from it the same date value I get 0, if subtract from it the date value of the day before I get 1 and so on and so forth.
But when I subract from a value from from April I get the correct value plus 70. Like, if I do (15 of May - the 30 of April) I should be getting 15 but instead I get 85 and so on, and if try to use March or February I get even higher values, if try (15 of May - the 6 of February) I get 309.
What can I do?