Skip to main content
Version: V1.0.0

CONVERT_TZ

Declaration

CONVERT_TZ(dt,from_tz,to_tz)

Description

Converts the datetime value dt from the time zone specified by from_tz to the time zone specified by to_tz and returns the result. If the dt parameter is invalid, NULL is returned.

If the value is out of the supported range of the TIMESTAMP type when converted from from_tz to UTC, the conversion does not occur. For more information about the range of the TIMESTAMP type, see DATE, DATETIME, and TIMESTAMP types.

Examples

SELECT CONVERT_TZ('2014-01-01 12:00:00','+00:00','+8:00');
+----------------------------------------------------+
| CONVERT_TZ('2014-01-01 12:00:00','+00:00','+8:00') |
+----------------------------------------------------+
| 2014-01-01 20:00:00 |
+----------------------------------------------------+
1 row in set (0.001 sec)