1SELECT DATEDIFF(expr1,expr2) as difference_in_days;
2
3
4select DATEDIFF('2020-05-15', '2020-05-10'); //returns 5
5select DATEDIFF('2020-05-13', '2020-05-16'); //returns -3
6select DATEDIFF('2020-06-30', '2020-05-30'); //returns 30
7
1SELECT TIME_TO_SEC(TIMEDIFF('2021-05-22 12:00:00', '2021-05-22 12:00:37')) as diff_in_seconds;