本文介绍如何修改RDS MySQL实例的时区,您可以在RDS控制台修改时区参数,也可以调用API接口修改时区参数。
前提条件
您已经创建RDS MySQL实例,创建方法请参见快速创建RDS MySQL实例。
背景信息
-
应用场景
在以下场景下,您需要修改RDS MySQL实例的时区:
-
系统中RDS MySQL实例的时区与您业务所在地域的时区不符,例如,2021年5月30日之前购买的RDS MySQL实例的默认时区为SYSTEM,需要修改为您业务所在地域的时区。
-
美国、加拿大、澳大利亚、欧洲等国家在夏令时和冬令时交替时,需要您手动调整所使用的标准时间。例如,英国在由冬令时转换为夏令时时,需要将冬令时时间(UTC)修改为夏令时时间(UTC+1) 。
-
-
注意事项
时区参数修改后,需要重启实例才能生效。建议您在业务低峰期操作,并确保应用程序具有重连机制。
在RDS控制台修改时区
- 访问RDS实例列表,在上方选择地域,然后单击目标实例ID。
-
在左侧导航栏中,单击参数设置。
-
在可修改参数页签内找到default_time_zone参数,单击运行参数值列的
,在弹出的对话框中修改时区的值,完成后单击确定。
说明
default_time_zone参数的取值含义,请参见时区与UTC偏移量对照表。
-
单击提交参数,在弹出的对话框中,选择生效的时间段,完成后单击确定。
说明
参数的修改未提交时,如果想取消修改,请单击撤销。
调用API接口修改时区
请求示例
本示例调用ModifyParameter接口将时区参数default_time_zone修改为+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
格式返回结果
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId": "6D698793-FC2B-5FC1-A6DF-33EDAD1AD6AB"
}
验证时区修改结果
- 访问RDS实例列表,在上方选择地域,然后单击目标实例ID。
-
在左侧导航栏中,单击参数设置。
-
在参数修改历史页签内查看修改的时区参数值已生效。
时区与UTC偏移量对照表
时区 |
标准时间偏移 |
备注 |
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. |
Cen. 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 |
E. Africa Standard Time |
(UTC+03:00) |
Nairobi |
E. Australia Standard Time |
(UTC+10:00) |
Brisbane |
E. Europe Standard Time |
(UTC+02:00) |
Chisinau |
E. 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 |
Russian 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 |
China 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 |
W. Australia Standard Time |
(UTC+08:00) |
Perth |
W. Central Africa Standard Time |
(UTC+01:00) |
West Central Africa |
W. 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 |
内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家
阿里云企业补贴进行中: 马上申请
腾讯云限时活动1折起,即将结束: 马上收藏
同尘科技为腾讯云授权服务中心。
购买腾讯云产品享受折上折,更有现金返利:同意关联,立享优惠
转转请注明出处:https://www.yunxiaoer.com/156146.html