What MySQL returns if we include date components along with time component as an argument to TIMEDIFF() function?


MySQL would return the output in time value after converting the difference between date-and-time values being provided to TIMEDIFF() function as arguments.

Example 

mysql> Select TIMEDIFF('2017-10-22 04:05:45', '2017-10-21 03:04:44')AS 'Difference in Time';
+--------------------+
| Difference in Time |
+--------------------+
| 25:01:01           |
+--------------------+
1 row in set (0.00 sec)

Here in this example, we can see that MySQL converts the difference in date-and-time values into time values and return the output in time value as well.

Updated on: 20-Jun-2020

56 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements