I have to compare 2 hours, one that is already registered in the database, and the current time, I have been told that I can use the timestamp in MySQL to make it return a true or false and the minutes of difference, then in java I must receive what it returns and depending on what it is to perform an action. Could someone give me an example of this? Thank you very much.
You can also use the
TIMESTAMPDIFF
MySQL function. To compare the minutes:It will return
1
if 120 minutes have not passed yet or0
otherwise, depending on the value ofnombre_columna
(TIMESTAMP
) up to the current time.———————
NOTE : To use this MySQL function in JPA, a native SQL statement (
createNativeQuery
) can be used.It will not return a true or false, but the difference, but with that you process it in the java