数据仓库服务 GAUSSDB(DWS)-时间/日期函数:convert_tz(timestamp, from_tz, to_tz)

时间:2024-10-21 16:50:41

convert_tz(timestamp, from_tz, to_tz)

描述:将时间日期值timestamp 从from_tz (text)给出的时区转到to_tz(text)给出的时区,返回转换后的时区时间。该函数仅8.2.0及以上集群版本支持。

返回值类型:timestamp without time zone

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SELECT convert_tz('2018-12-25 13:25:00', '+02:00', '+08:00');
    convert_tz       
--------------------
 2018-12-25 19:25:00
(1 row)
SELECT convert_tz('2000-02-28 23:00:00', 'GMT', 'MET');
    convert_tz       
--------------------
 2000-02-29 00:00:00
(1 row)
support.huaweicloud.com/sqlreference-830-dws/dws_06_0309.html