content_image/820274.jpg
<img src='content_image/820274.jpg'>

## Note 

Unlike CAST() , CONVERT()  does not  support multi-valued index creation or the ARRAY  keyword. 

Beginning with MySQL 8.0.22, CAST()  supports retrieval of a TIMESTAMP  value as being in UTC, using the AT TIMEZONE  operator. The only supported time zone is UTC; this can be specified as either of ’+00:00’  or ’UTC’ . The only return type supported by this syntax is DATETIME , with an optional precision specifier in the range of 0 to 6, inclusive. 

TIMESTAMP  values that use timezone offsets are also supported. 

mysql> SELECT @@system_time_zone; +--------------------+ | @@system_time_zone | +--------------------+ | EDT | +--------------------+ 1 row in set (0.00 sec) mysql> CREATE TABLE TZ (c TIMESTAMP); Query OK, 0 rows affected (0.41 sec) mysql> INSERT INTO tz VALUES > ROW(CURRENT_TIMESTAMP), > ROW(’2020-07-28 14:50:15+1:00’); Query OK, 1 row affected (0.08 sec) mysql> TABLE tz; +---------------------+ | c | +---------------------+ | 2020-07-28 09:22:41 | | 2020-07-28 09:50:15 | +---------------------+ 2 rows in set (0.00 sec) mysql> SELECT CAST(c AT TIME ZONE ’+00:00’ AS DATETIME) AS u FROM tz; +---------------------+ | u | +---------------------+ | 2020-07-28 13:22:41 | | 2020-07-28 13:50:15 | +---------------------+ 2 rows in set (0.00 sec) mysql> SELECT CAST(c AT TIME ZONE ’UTC’ AS DATETIME(2)) AS u FROM tz; +------------------------+ | u | +------------------------+ | 2020-07-28 13:22:41.00 | | 2020-07-28 13:50:15.00 | +------------------------+ 2 rows in set (0.00 sec) 

If you use ’UTC’  as the time zone specifier with this form of CAST() , and the server raises an error such as Unknown or incorrect time zone: ’UTC’ , you may need to install the MySQL time zone tables (see Populating the Time Zone Tables). 

AT TIME ZONE  does not support the ARRAY  keyword, and is not supported by the CONVERT()  function. 

