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

时间:2025-02-12 15:04:42

from_unixtime(unix_timestamp[,format])

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

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

示例:

 1 2 3 4 5 6 7 8 910
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 5th October 04:23:00(1 row)
support.huaweicloud.com/sqlreference-910-dws/dws_06_0309.html
推荐文章