MySQL retrieves and displays
TIME values in
'HH:MM:SS' format (or
'HHH:MM:SS' format for large hours values).
TIME values may range from
'838:59:59'. The hours part may be so large
TIME type can be used not only to
represent a time of day (which must be less than 24 hours), but
also elapsed time or a time interval between two events (which
may be much greater than 24 hours, or even negative).
TIME values in several
formats, some of which can include a trailing fractional seconds
part in up to microseconds (6 digits) precision. See
Section 9.1.3, “Date and Time Literals”. For information about
fractional seconds support in MySQL, see
Section 11.3.6, “Fractional Seconds in Time Values”. In particular, any
fractional part in a value inserted into a
TIME column is stored rather than discarded.
With the fractional part included, the range for
TIME values is
Be careful about assigning abbreviated values to a
TIME column. MySQL interprets abbreviated
TIME values with colons as time of the day.
'00:11:12'. MySQL interprets abbreviated
values without colons using the assumption that the two
rightmost digits represent seconds (that is, as elapsed time
rather than as time of day). For example, you might think of
1112 as meaning
'11:12:00' (12 minutes after 11 o'clock), but
MySQL interprets them as
minutes, 12 seconds). Similarly,
12 are interpreted as
The only delimiter recognized between a time part and a fractional seconds part is the decimal point.
By default, values that lie outside the
range but are otherwise valid are clipped to the closest
endpoint of the range. For example,
'850:00:00' are converted to
values are converted to
'00:00:00'. Note that
'00:00:00' is itself a valid
TIME value, there is no way to tell, from a
'00:00:00' stored in a table,
whether the original value was specified as
'00:00:00' or whether it was invalid.
For more restrictive treatment of invalid
TIME values, enable strict SQL mode to cause
errors to occur. See Section 5.1.11, “Server SQL Modes”.