# CONVERT\_TZ

## Syntax

```sql
CONVERT_TZ(dt,from_tz,to_tz)
```

## Description

`CONVERT_TZ()` converts a datetime value *dt* from the [time zone](/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/time-zones.md) given by *from\_tz* to the time zone given by *to\_tz* and returns the resulting value.

In order to use named time zones, such as GMT, MET or Africa/Johannesburg, the `time_zone` tables must be loaded (see [mysql\_tzinfo\_to\_sql](/docs/server/clients-and-utilities/legacy-clients-and-utilities/mysql_tzinfo_to_sql.md)).

No conversion takes place if the value falls outside of the supported `TIMESTAMP` range when converted from *from\_tz* to UTC.

{% tabs %}
{% tab title="Currrent" %}
The supported range is `1970-01-01 00:00:00` to `2106-02-07 06:28:15` UTC.
{% endtab %}

{% tab title="< 11.5" %}
The supported range is `1970-01-01 00:00:01` to `2038-01-19 05:14:07` UTC.
{% endtab %}
{% endtabs %}

This function returns `NULL` if the arguments are invalid (or named time zones have not been loaded).

See [time zones](/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/time-zones.md) for more information.

## Examples

```sql
SELECT CONVERT_TZ('2016-01-01 12:00:00','+00:00','+10:00');
+-----------------------------------------------------+
| CONVERT_TZ('2016-01-01 12:00:00','+00:00','+10:00') |
+-----------------------------------------------------+
| 2016-01-01 22:00:00                                 |
+-----------------------------------------------------+
```

Using named time zones (with the time zone tables loaded):

```sql
SELECT CONVERT_TZ('2016-01-01 12:00:00','GMT','Africa/Johannesburg');
+---------------------------------------------------------------+
| CONVERT_TZ('2016-01-01 12:00:00','GMT','Africa/Johannesburg') |
+---------------------------------------------------------------+
| 2016-01-01 14:00:00                                           |
+---------------------------------------------------------------+
```

The value is out of the `TIMESTAMP` range, so no conversion takes place:

```sql
SELECT CONVERT_TZ('1969-12-31 22:00:00','+00:00','+10:00');
+-----------------------------------------------------+
| CONVERT_TZ('1969-12-31 22:00:00','+00:00','+10:00') |
+-----------------------------------------------------+
| 1969-12-31 22:00:00                                 |
+-----------------------------------------------------+
```

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/convert_tz.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
