跳到主要内容

TIME

TIME

name

TIME

description

TIME 类型 时间类型,可以作为查询结果出现,暂时不支持建表存储。表示范围为 [-838:59:59, 838:59:59]。 当前 Doris 中,TIME 作为计算结果的正确性是有保证的(如 timediff 等函数),但不推荐手动 CAST 产生 TIME 类型。 TIME 类型不会在常量折叠中进行计算。

example

mysql> select timediff('2020-01-01 12:05:03', '2020-01-01 08:02:15');
+------------------------------------------------------------------------------------------------------+
| timediff(cast('2020-01-01 12:05:03' as DATETIMEV2(0)), cast('2020-01-01 08:02:15' as DATETIMEV2(0))) |
+------------------------------------------------------------------------------------------------------+
| 04:02:48 |
+------------------------------------------------------------------------------------------------------+
1 row in set (0.12 sec)

mysql> select timediff('2020-01-01', '2000-01-01');
+------------------------------------------------------------------------------------+
| timediff(cast('2020-01-01' as DATETIMEV2(0)), cast('2000-01-01' as DATETIMEV2(0))) |
+------------------------------------------------------------------------------------+
| 838:59:59 |
+------------------------------------------------------------------------------------+
1 row in set (0.11 sec)

keywords

TIME