MySQL | TIME
Start your free 7-days trial now!
TIME type is used when we do not need information about the date. It has the following syntax:
'hh:mm:ss' ('hhh:mm:ss' --format for large hours values)
A few useful points to note:
The supported range is
The possible hour value is greater than 24 as time values can also be used to represent time intervals.
Values that are outside the valid
TIMErange but are otherwise valid are converted to the closer of the upper or lower
TIMEvalues are converted to
Assumption of abbreviated values
If you do not provide the
TIME value in full, the following assumptions are made when converting:
Colons are taken to represent time of day
Represent time interval. Two rightmost digits represent seconds.
TIME value can store a fractional seconds portion for microseconds (up to 6 digits precision).
The delimiter between seconds and microseconds must be a dot (
For the fractional seconds to be stored, the column must be defined to accept fractional seconds up to specific precision. The general syntax is as follows:
TIMESTAMP data types can hold fractional second information:
CREATE TABLE sample_table (column1 TIME(3), column2 DATETIME(6), column3 TIMESTAMP(1));