Files
doris/docs/zh-CN/sql-reference/sql-functions/date-time-functions/convert_tz.md
steadyBoy 5cc62fa166 [docs] fix document date-time-functions typo (#8053)
1. en: add convert_tz.md
2. en: fix curdate.md, the fix is to modify the title
3. en: add curtime.md
4. en: fix str_to_date.md, the fix is to modify the title
5. zh-CN: fix convert_tz.md, the fix is to modify the description
6. zh-CN: fix curdate.md, the fix is to modify the title
2022-03-02 10:07:44 +08:00

2.0 KiB

title, language
title language
convert_tz zh-CN

convert_tz

description

Syntax

DATETIME CONVERT_TZ(DATETIME dt, VARCHAR from_tz, VARCHAR to_tz)

转换datetime值,从 from_tz 给定时区转到 to_tz 给定时区,并返回结果值。 如果参数无效该函数返回NULL。

Example

mysql> select convert_tz('2019-08-01 13:21:03', 'Asia/Shanghai', 'America/Los_Angeles');
+---------------------------------------------------------------------------+
| convert_tz('2019-08-01 13:21:03', 'Asia/Shanghai', 'America/Los_Angeles') |
+---------------------------------------------------------------------------+
| 2019-07-31 22:21:03                                                       |
+---------------------------------------------------------------------------+

mysql> select convert_tz('2019-08-01 13:21:03', '+08:00', 'America/Los_Angeles');
+--------------------------------------------------------------------+
| convert_tz('2019-08-01 13:21:03', '+08:00', 'America/Los_Angeles') |
+--------------------------------------------------------------------+
| 2019-07-31 22:21:03                                                |
+--------------------------------------------------------------------+

keyword

CONVERT_TZ