sql函数 的 SQL CONVERT_TZ()函数

CONVERT_TZ(dt,from_tz,to_tz)

转换datetime值dt从from_tz给出的时区被赋予转到to_tz的时区并返回结果值。 如果参数无效此函数返回NULL。

mysql> SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
+---------------------------------------------------------+
| CONVERT_TZ('2004-01-01 12:00:00','GMT','MET')           |
+---------------------------------------------------------+
| 2004-01-01 13:00:00                                     |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00');
+---------------------------------------------------------+
| CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00')     |
+---------------------------------------------------------+
| 2004-01-01 22:00:00                                     |
+---------------------------------------------------------+
1 row in set (0.00 sec)

返回sql函数教程,您可手机上继续学习sql函数教程SQL CONVERT_TZ()函数语法,或扫下面二维码自动跳转。