Calculating time difference between 2 dates in minutes Calculating time difference between 2 dates in minutes mysql mysql

Calculating time difference between 2 dates in minutes


I think you could use TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2) something like

select * from MyTab T whereTIMESTAMPDIFF(MINUTE,T.runTime,NOW()) > 20


ROUND(time_to_sec((TIMEDIFF(NOW(), "2015-06-10 20:15:00"))) / 60);


I am using below code for today and database date.

TIMESTAMPDIFF(MINUTE,T.runTime,NOW()) > 20

According to the documentation, the first argument can be any of the following:

MICROSECONDSECONDMINUTEHOURDAYWEEKMONTHQUARTERYEAR