bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL TIMEDIFF() Function

Concept visual

MySQL TIMEDIFF() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return the difference between two time expressions: SELECT TIMEDIFF("13:10:11", "13:10:10");

Definition and Usage

Formula

The TIMEDIFF() function returns the difference between two time/datetime expressions.

Note:

time1 and time2 should be in the same format, and the calculation is time1

time2.

Syntax

Timediff(

time1, time2 )

Parameter Values

Parameter

Description time1

Required. A time value time2 Required. Another time value

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Return the difference between two datetime expressions: SELECT TIMEDIFF("2017-06-25 13:10:11", "2017-06-15 13:10:10");

Previous

❮ MySQL Functions

Next

Previous

MySQL TIME_TO_SEC() Function

Next

MySQL TIMESTAMP() Function