# Converting the MySQL time zone

> Convert dates and times between time zones in MySQL with the CONVERT_TZ function, since you cannot change the server's time zone on shared hosting.

Source: https://helpcenter.ruachost.com/developers/databases/converting-the-mysql-time-zone/

## Using the CONVERT_TZ Function

Ruachost servers, including MySQL, run on UTC (GMT+0).

On shared servers, you cannot change the default MySQL time zone, because it affects other accounts on the server. However, you can convert the time zone for `DATE`, `TIME`, and `DATETIME` fields by using the `CONVERT_TZ` function.

**Example:** Convert the current server time (UTC) to Lagos, Nigeria:

```sql
SELECT CONVERT_TZ(NOW(), '+00:00', '+01:00');
```

Using UTC offsets such as `+01:00` always works. Named zones such as `Africa/Lagos` only work if the server has the MySQL time zone tables loaded.

> **Tip:**
For a complete list of time zones, visit [List of TZ database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

## More Information

- For time zone support in MySQL, visit [MySQL Time Zone Support](https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html).
- For details on the `CONVERT_TZ` function, visit [CONVERT_TZ Function](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_convert-tz).
- To make MySQL use your local time for your website, see [Setting the MySQL time zone for your website](https://helpcenter.ruachost.com/cpanel/databases/setting-the-mysql-time-zone/).
