You can change the time zone of an ApsaraDB RDS for MySQL instance in the console or by calling an API operation when the instance time zone does not match your business region, or when you need to adjust for daylight saving time transitions.
Use cases
You need to change the time zone of an RDS MySQL instance in the following scenarios:
-
The time zone of your RDS MySQL instance does not match your business region. For example, RDS MySQL instances created before May 30, 2021 use the SYSTEM time zone by default, which may differ from your business region.
-
Countries such as the United States, Canada, Australia, and parts of Europe switch between daylight saving time and winter time, requiring a manual time zone adjustment. For example, when the United Kingdom switches from winter time (UTC) to daylight saving time, you must change the time zone from UTC to
UTC+1.
Prerequisites
Considerations
-
After you change the time zone parameter, you must restart the instance for the new setting to take effect. We recommend that you perform this operation during off-peak hours and ensure that your application has a reconnection mechanism.
-
If the
default_time_zoneparameter of MySQL is set to SYSTEM, the following risks may occur:-
Inconsistent time between primary and secondary nodes
For a high-availability instance that uses a high-performance local disk, different operating system time zones on the primary and secondary nodes can cause inconsistent MySQL time zones. In extreme cases, this can affect data consistency.
-
Decreased instance performance
If your services frequently use
TIMESTAMPtype fields, time zone conversions may cause lock contention, which can lead to fluctuations in instance performance. -
Inconsistent parsing of the CST time zone between JDBC and MySQL
The CST time zone abbreviation is ambiguous: MySQL interprets it as China Standard Time (
UTC+08:00) by default, while some JDBC versions (such as 8.0.22 and 8.0.23) interpret it as American Central Time (UTC - 6). When the host operating system time zone is CST, JDBC may read or write incorrect data to MySQL. For a typical example, see The time zone CST has different meanings on MySQL Server and on connector/j.
-
Change the time zone in the console
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
-
In the navigation pane on the left, click Parameters.
-
On the Modifiable Parameters tab, find the
default_time_zoneparameter, click Running Parameter Value, and in the dialog box that appears, modify the time zone value.NoteFor more information about the values of the
default_time_zoneparameter, see Time zones and UTC offsets. -
Click Apply Changes. In the dialog box that appears, select when you want the change to take effect, and then click OK.
NoteIf you want to cancel the modification before you apply the changes, click Cancel Changes.
Change the time zone via API
Request example
The following example calls the ModifyParameter API operation to change the value of the default_time_zone parameter to +9:00.
...
// Parameter settings for API request
ModifyParameterRequest modifyParameterRequest = ModifyParameterRequest.builder()
.DBInstanceId("rm-bp1l94k5sw1zxxxxx")
.parameters("{"default_time_zone":"+9:00"}")
.forcerestart(true)
// Request-level configuration rewrite, can set Http request parameters, etc.
// .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders()))
.build();
...
JSON-formatted response
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId": "6D698793-FC2B-5FC1-A6DF-33EDAD1AD6AB"
}
Verify the time zone change
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
-
In the navigation pane on the left, click Parameters.
-
On the Edit History tab, verify that the time zone parameter is updated.
The value of the
default_time_zoneparameter is changed fromSYSTEMto+9:00.
Time zone and UTC offset reference
|
Time zone |
Standard time offset |
Remarks |
|
Afghanistan Standard Time |
(UTC+04:30) |
Kabul |
|
Alaskan Standard Time |
(UTC-09:00) |
Alaska |
|
Arabian Standard Time |
(UTC+04:00) |
Abu Dhabi, Muscat |
|
Atlantic Standard Time |
(UTC-04:00) |
Atlantic Time (Canada) |
|
AUS Central Standard Time |
(UTC+09:30) |
Darwin |
|
AUS Eastern Standard Time |
(UTC+10:00) |
Canberra, Melbourne, Sydney |
|
Belarus Standard Time |
(UTC+03:00) |
Minsk |
|
Canada Central Standard Time |
(UTC-06:00) |
Saskatchewan |
|
Cape Verde Standard Time |
(UTC-01:00) |
Cabo Verde Is. |
|
Central Australia Standard Time |
(UTC+09:30) |
Adelaide |
|
Central America Standard Time |
(UTC-06:00) |
Central America |
|
Central Asia Standard Time |
(UTC+06:00) |
Astana |
|
Central Brazilian Standard Time |
(UTC-04:00) |
Cuiaba |
|
Central Europe Standard Time |
(UTC+01:00) |
Belgrade, Bratislava, Budapest, Ljubljana, Prague |
|
Central European Standard Time |
(UTC+01:00) |
Sarajevo, Skopje, Warsaw, Zagreb |
|
Central Pacific Standard Time |
(UTC+11:00) |
Solomon Islands, New Caledonia |
|
Central Standard Time |
(UTC-06:00) |
Central Time (US and Canada) |
|
Central Standard Time (Mexico) |
(UTC-06:00) |
Guadalajara, Mexico City, Monterrey |
|
China Standard Time |
(UTC+08:00) |
Beijing, Chongqing, Hong Kong, Urumqi |
|
East Africa Standard Time |
(UTC+03:00) |
Nairobi |
|
East Australia Standard Time |
(UTC+10:00) |
Brisbane |
|
East Europe Standard Time |
(UTC+02:00) |
Chisinau |
|
East South America Standard Time |
(UTC-03:00) |
Brasilia |
|
Eastern Standard Time |
(UTC-05:00) |
Eastern Time (US and Canada) |
|
Georgian Standard Time |
(UTC+04:00) |
Tbilisi |
|
GMT Standard Time |
(UTC) |
Dublin, Edinburgh, Lisbon, London |
|
Greenland Standard Time |
(UTC-03:00) |
Greenland |
|
Greenwich Standard Time |
(UTC) |
Monrovia, Reykjavik |
|
GTB Standard Time |
(UTC+02:00) |
Athens, Bucharest |
|
Hawaiian Standard Time |
(UTC-10:00) |
Hawaii |
|
India Standard Time |
(UTC+05:30) |
Chennai, Kolkata, Mumbai, New Delhi |
|
Jordan Standard Time |
(UTC+02:00) |
Amman |
|
Korea Standard Time |
(UTC+09:00) |
Seoul |
|
Middle East Standard Time |
(UTC+02:00) |
Beirut |
|
Mountain Standard Time |
(UTC-07:00) |
Mountain Time (US and Canada) |
|
Mountain Standard Time (Mexico) |
(UTC-07:00) |
Chihuahua, La Paz, Mazatlan |
|
US Mountain Standard Time |
(UTC-07:00) |
Arizona |
|
New Zealand Standard Time |
(UTC+12:00) |
Auckland, Wellington |
|
Newfoundland Standard Time |
(UTC-03:30) |
Newfoundland |
|
Pacific SA Standard Time |
(UTC-03:00) |
Santiago |
|
Pacific Standard Time |
(UTC-08:00) |
Pacific Time (US and Canada) |
|
Pacific Standard Time (Mexico) |
(UTC-08:00) |
Baja California |
|
Russia Standard Time |
(UTC+03:00) |
Moscow, St. Petersburg, Volgograd |
|
SA Pacific Standard Time |
(UTC-05:00) |
Bogota, Lima, Quito, Rio Branco |
|
SE Asia Standard Time |
(UTC+07:00) |
Bangkok, Hanoi, Jakarta |
|
Singapore Standard Time |
(UTC+08:00) |
Kuala Lumpur, Singapore |
|
Tokyo Standard Time |
(UTC+09:00) |
Osaka, Sapporo, Tokyo |
|
US Eastern Standard Time |
(UTC-05:00) |
Indiana (East) |
|
UTC |
UTC |
Coordinated Universal Time |
|
UTC-02 |
(UTC-02:00) |
Coordinated Universal Time-02 |
|
UTC-08 |
(UTC-08:00) |
Coordinated Universal Time-08 |
|
UTC-09 |
(UTC-09:00) |
Coordinated Universal Time-09 |
|
UTC-11 |
(UTC-11:00) |
Coordinated Universal Time-11 |
|
UTC+12 |
(UTC+12:00) |
Coordinated Universal Time+12 |
|
West Australia Standard Time |
(UTC+08:00) |
Perth |
|
West Central Africa Standard Time |
(UTC+01:00) |
West Central Africa |
|
West Europe Standard Time |
(UTC+01:00) |
Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna |
|
Kathmandu Time |
(UTC+5:45) |
Kathmandu |
|
Myanmar Time |
(UTC+6:30) |
Rangoon, Nay Pyi Taw |
|
Uzbekistan Time |
(UTC+5) |
Lahore, Karachi, Islamabad |
|
Samoa Western Standard Time |
(UTC+13) |
Nuku Alofa, Appiah |
|
UTC-12 |
(UTC-12) |
Coordinated Universal Time-12 |
FAQ
Related API
You can modify default_time_zone by calling the ModifyParameter API.