MySql data type interval

Does MySql have an Interval data type like PostgreSQL (or like TimeSpan in .net)?

+3
source share
2 answers

No, in MySQL there is no time interval data type. There is a function request for one, but apparently it has not received much attention.

The type of time can be used for this purpose, although, as provided in the documentation

MySQL retrieves and displays TIME values ​​in the format "HH: MM: SS" (or the Format "HHH: MM: SS" for large hours of value). TIME values ​​can range from '-838: 59: 59' to '838: 59: 59'. The clock part can be so large, because the TIME type can be used not only to represent the time of day (which should be less than 24 hours), but also the elapsed time or time interval between two events (which can be much more than 24 hours or even negative).

+3
source

No. Interval functions exist, but not data types.

, , 838 , TIME, , .

:

MySQL interprets TIME values as elapsed time rather than as time of day.
+1

Source: https://habr.com/ru/post/1771813/


All Articles