
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What happens if the output of MySQL TIMEDIFF() function surpass the range value of TIME field?
As we know that the range of TIME field in MySQL is ‘-838:59:59’ to ‘838:59:59’. Now, if TIMEDIFF() function’s output surpasses this range then MySQL will return either ‘-838:59:59’ or ‘838:59:59’ depends upon the values of the argument.
Example
mysql> Select TIMEDIFF('2017-09-01 03:05:45','2017-10-22 03:05:45')AS 'Out of Range TIME Difference'; +------------------------------+ | Out of Range TIME Difference | +------------------------------+ | -838:59:59 | +------------------------------+ 1 row in set, 1 warning (0.00 sec) mysql> Select TIMEDIFF('2017-10-22 04:05:45','2017-09-01 03:05:45')AS 'Out of Range TIME Difference'; +------------------------------+ | Out of Range TIME Difference | +------------------------------+ | 838:59:59 | +------------------------------+ 1 row in set, 1 warning (0.01 sec)
The queries above shows that in case the total difference is out of range, MySQL returns either maximum or minimum limit values of the range of TIME field.
- Related Articles
- What happens if the position of insertion, in MySQL INSERT() function, is out of range?
- What happens with the output of MySQL EXPORT_SET() function if I will skip the value of the fifth argument i.e. a number of bits?
- What MySQL returns if we include date components along with time component as an argument to TIMEDIFF() function?
- What is the range of date time value that we can pass as an argument to MySQL UNIX_TIMESTAMP function?
- What happens if the argument ‘count’ in MySQL SUBSTRING_INDEX() function has the value greater than the total number of occurrences of delimiter?
- What happens with the output of MySQL EXPORT_SET() function if I will skip both 4th and 5th argument i.e. separator and number of bits?
- MySQL convert timediff output to day, hour, minute, second format?
- What is MySQL STRCMP() function and what would be the output of this function?
- What happens when MySQL encounters an out-of-range date?
- What would be the effect on MySQL output if we have the combination of NULL and other values in the list of strings, provided as arguments in FIELD() function?
- What happens if I pass only one argument to the MySQL CONCAT() function?
- What happens if I will use integer values as arguments of MySQL LOCATE() function?
- What would be effect of negative value of second argument, which specifies the number of decimal places, on the output of MySQL ROUND() function?
- What would be effect of negative value of second argument, which specifies the number of decimal places, on the output of MySQL TRUNCATE() function?
- What MySQL returns if the list of strings, provided as argument in FIELD() function, are NULL?

Advertisements