数据仓库服务 GAUSSDB(DWS)-时间/日期函数:from_unixtime(unix_timestamp[,format])

时间:2024-09-05 10:32:34

from_unixtime(unix_timestamp[,format])

描述:格式串缺省时,将unix时间戳转换为日期时间类型输出。格式串指定时,将unix时间戳转换为指定格式的字符串输出。

返回值类型:timestamp(格式串缺省)/ text(格式串指定)

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SELECT from_unixtime(875996580);
    from_unixtime
---------------------
 1997-10-04 20:23:00
(1 row)
SELECT from_unixtime(875996580, '%Y %D %M %h:%i:%s');
       from_unixtime
---------------------------
 1997 4th October 08:23:00
(1 row)
support.huaweicloud.com/sqlreference-dws/dws_06_0309.html
推荐文章