ID EN
Date and Time Functions

CONVERT_TZ(dt,from_tz,to_tz)

MySQL 8.4

CONVERT_TZ() converts a datetime value dt from the time zone given by from_tz to the time zone given by to_tz and returns the resulting value. Time zones are specified as described in Section 7.1.15, “MySQL Server Time Zone Support”. This function returns NULL if any of the arguments are invalid, or if any of them are NULL.

Syntax

MYSQL
SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
'2004-01-01 13:00:00'
SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00');
'2004-01-01 22:00:00'

Examples

Example

On 32-bit platforms, the supported range of values for this function is the same as for the TIMESTAMP type (see Section 13.2.1, “Date and Time Data Type Syntax”, for range information). On 64-bit platforms, the maximum supported value is '3001-01-18 23:59:59.999999' UTC.

MYSQL
SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
'2004-01-01 13:00:00'
SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00');
'2004-01-01 22:00:00'