[Azure] Web App 日本時間に設定をする

Azure Web App、便利なためいろいろなプロジェクトに使用しています。

ただ、デフォでサーバー時間がGMTのため、 DateTime.Now みたいな関数を使う際にはGMTになってしまいます。

ということで、ここで日本時間へ設定してみます。

# 設定
App Service > Configuration へ

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/241909/9d91db4c-1b7c-ade6-9c8c-fe60b4ce48f5.png)

New application setting をクリック

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/241909/d65c11e5-e6c8-a6a0-a2f9-d3434f2c323b.png)

WEBSITE_TIME_ZONE　を Tokyo Standard Timeに設定します。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/241909/1e477bcb-947b-3087-e249-1f94ae959114.png)

# 確認

アプリケーションを該当サーバーにあげて、local で時間が取得できるように下記のコードを用意。
（CLからたたいたほうが簡単かも)

```csharp
[HttpGet("/DateTimeNow")]
[ProducesResponseType(201)]
public ActionResult GetServerTime()
{
  return Ok(DateTime.Now);
}
```

サーバーにて確認

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/241909/a4df2636-30e3-6028-4d7c-eff6a3057fca.png)

ちゃんと日本時間になっていました。

# 他の時間

他の時間帯に設定したいときは下記の値を参照ください。

- Value="Morocco Standard Time" For (GMT) Casablanca
- Value="GMT Standard Time" For (GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London
- Value="Greenwich Standard Time" For (GMT) Monrovia, Reykjavik
- Value="W. Europe Standard Time" For (GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
- Value="Central Europe Standard Time" For (GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
- Value="Romance Standard Time" For (GMT+01:00) Brussels, Copenhagen, Madrid, Paris
- Value="Central European Standard Time" For (GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb
- Value="W. Central Africa Standard Time" For (GMT+01:00) West Central Africa
- Value="Jordan Standard Time" For (GMT+02:00) Amman
- Value="GTB Standard Time" For (GMT+02:00) Athens, Bucharest, Istanbul
- Value="Middle East Standard Time" For (GMT+02:00) Beirut
- Value="Egypt Standard Time" For (GMT+02:00) Cairo
- Value="South Africa Standard Time" For (GMT+02:00) Harare, Pretoria
- Value="FLE Standard Time" For (GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius
- Value="Israel Standard Time" For (GMT+02:00) Jerusalem
- Value="E. Europe Standard Time" For (GMT+02:00) Minsk
- Value="Namibia Standard Time" For (GMT+02:00) Windhoek
- Value="Arabic Standard Time" For (GMT+03:00) Baghdad
- Value="Arab Standard Time" For (GMT+03:00) Kuwait, Riyadh
- Value="Russian Standard Time" For (GMT+03:00) Moscow, St. Petersburg, Volgograd
- Value="E. Africa Standard Time" For (GMT+03:00) Nairobi
- Value="Georgian Standard Time" For (GMT+03:00) Tbilisi
- Value="Iran Standard Time" For (GMT+03:30) Tehran
- Value="Arabian Standard Time" For (GMT+04:00) Abu Dhabi, Muscat
- Value="Azerbaijan Standard Time" For (GMT+04:00) Baku
- Value="Mauritius Standard Time" For (GMT+04:00) Port Louis
- Value="Caucasus Standard Time" For (GMT+04:00) Yerevan
- Value="Afghanistan Standard Time" For (GMT+04:30) Kabul
- Value="Ekaterinburg Standard Time" For (GMT+05:00) Ekaterinburg
- Value="Pakistan Standard Time" For (GMT+05:00) Islamabad, Karachi
- Value="West Asia Standard Time" For (GMT+05:00) Tashkent
- Value="India Standard Time" For (GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi
- Value="Sri Lanka Standard Time" For (GMT+05:30) Sri Jayawardenepura
- Value="Nepal Standard Time" For (GMT+05:45) Kathmandu
- Value="N. Central Asia Standard Time" For (GMT+06:00) Almaty, Novosibirsk
- Value="Central Asia Standard Time" For (GMT+06:00) Astana, Dhaka
- Value="Myanmar Standard Time" For (GMT+06:30) Yangon (Rangoon)
- Value="SE Asia Standard Time" For (GMT+07:00) Bangkok, Hanoi, Jakarta
- Value="North Asia Standard Time" For (GMT+07:00) Krasnoyarsk
- Value="China Standard Time" For (GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi
- Value="North Asia East Standard Time" For (GMT+08:00) Irkutsk, Ulaan Bataar
- Value="Singapore Standard Time" For (GMT+08:00) Kuala Lumpur, Singapore
- Value="W. Australia Standard Time" For (GMT+08:00) Perth
- Value="Taipei Standard Time" For (GMT+08:00) Taipei
- Value="Tokyo Standard Time" For (GMT+09:00) Osaka, Sapporo, Tokyo
- Value="Korea Standard Time" For (GMT+09:00) Seoul
- Value="Yakutsk Standard Time" For (GMT+09:00) Yakutsk
- Value="Cen. Australia Standard Time" For (GMT+09:30) Adelaide
- Value="AUS Central Standard Time" For (GMT+09:30) Darwin
- Value="E. Australia Standard Time" For (GMT+10:00) Brisbane
- Value="AUS Eastern Standard Time" For (GMT+10:00) Canberra, Melbourne, Sydney
- Value="West Pacific Standard Time" For (GMT+10:00) Guam, Port Moresby
- Value="Tasmania Standard Time" For (GMT+10:00) Hobart
- Value="Vladivostok Standard Time" For (GMT+10:00) Vladivostok
- Value="Central Pacific Standard Time" For (GMT+11:00) Magadan, Solomon Is., New Caledonia
- Value="New Zealand Standard Time" For (GMT+12:00) Auckland, Wellington
- Value="Fiji Standard Time" For (GMT+12:00) Fiji, Kamchatka, Marshall Is.
- Value="Tonga Standard Time" For (GMT+13:00) Nuku'alofa
- Value="Azores Standard Time" For (GMT-01:00) Azores
- Value="Cape Verde Standard Time" For (GMT-01:00) Cape Verde Is.
- Value="Mid-Atlantic Standard Time" For (GMT-02:00) Mid-Atlantic
- Value="E. South America Standard Time" For (GMT-03:00) Brasilia
- Value="Argentina Standard Time" For (GMT-03:00) Buenos Aires
- Value="SA Eastern Standard Time" For (GMT-03:00) Georgetown
- Value="Greenland Standard Time" For (GMT-03:00) Greenland
- Value="Montevideo Standard Time" For (GMT-03:00) Montevideo
- Value="Newfoundland Standard Time" For (GMT-03:30) Newfoundland
- Value="Atlantic Standard Time" For (GMT-04:00) Atlantic Time (Canada)
- Value="SA Western Standard Time" For (GMT-04:00) La Paz
- Value="Central Brazilian Standard Time" For (GMT-04:00) Manaus
- Value="Pacific SA Standard Time" For (GMT-04:00) Santiago
- Value="Venezuela Standard Time" For (GMT-04:30) Caracas
- Value="SA Pacific Standard Time" For (GMT-05:00) Bogota, Lima, Quito, Rio Branco
- Value="Eastern Standard Time" For (GMT-05:00) Eastern Time (US & Canada)
- Value="US Eastern Standard Time" For (GMT-05:00) Indiana (East)
- Value="Central America Standard Time" For (GMT-06:00) Central America
- Value="Central Standard Time" For (GMT-06:00) Central Time (US & Canada)
- Value="Central Standard Time (Mexico)" For (GMT-06:00) Guadalajara, Mexico City,Monterrey
- Value="Canada Central Standard Time" For (GMT-06:00) Saskatchewan
- Value="US Mountain Standard Time" For (GMT-07:00) Arizona
- Value="Mountain Standard Time (Mexico)" For (GMT-07:00) Chihuahua, La Paz, Mazatlan
- Value="Mountain Standard Time" For (GMT-07:00) Mountain Time (US & Canada)
- Value="Pacific Standard Time" For (GMT-08:00) Pacific Time (US & Canada)
- Value="Pacific Standard Time (Mexico)" For (GMT-08:00) Tijuana, Baja California
- Value="Alaskan Standard Time" For (GMT-09:00) Alaska
- Value="Hawaiian Standard Time" For (GMT-10:00) Hawaii
- Value="Samoa Standard Time" For (GMT-11:00) Midway Island, Samoa
- Value="Dateline Standard Time" For (GMT-12:00) International Date Line West