Interval datatype in MySql

前端 未结 2 1138
忘掉有多难
忘掉有多难 2021-01-12 23:06

Does MySql has the Interval datatype as PostgreSQL (or like TimeSpan in .net) does?

2条回答
  •  时光说笑
    2021-01-12 23:33

    Nope, there is no time interval data type in MySQL. There is a feature request for one though, but apparently it hasn't gotten much attention.

    The time type can be used for such a purpose though, as suggested by the documentation

    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' to '838:59:59'. The hours part may be so large because the 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).

提交回复
热议问题