3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

都市名から IANA zone name を知る方法

Last updated at Posted at 2019-06-18

プログラムでは、タイムゾーンの指定によく IANA time zone identifier というのを使う。都市名からこの IANA time zone を知る方法が意外とややこしかったのでメモする。

結論としては手で検索するには https://time.is/ が早い。例えば Osaka の場合 https://time.is/Osaka を見ると

The IANA time zone identifier for Osaka is Asia/Tokyo

と出る。このサイトは IANA の公式サイト https://data.iana.org/time-zones/tz-link.html からリンクされている。

プログラム的に同じ事をするには、Stackoverflow に沢山リンクが挙げられてある。

Time Zone Location Web Services

都市とタイムゾーンの対応付がどのように定義されているのかはよく分からなかった。Time Zone Databas とそのソースコード には、タイムゾーン名と対応する時差のみが定義されている。つまり、これだけでは大阪が Asia/Tokyo に含まれているかどうかは分からない。都市名や座標からタイムゾーンを取得する方法はいくつもあるが、それらが参照する唯一の公式な定義というものは無いようだ。

公式サイトからは Timezone Boundary Builder が紹介されている。ただこのプロジェクトは OpenStreetMap を元にタイムゾーンの境界線を作成するものなので、OpenStreetMap 自体が誰でも編集出来るものである以上、「公式」なのかどうかは微妙だ。もしかしてタイムゾーン境界の定義というのは政治的な問題を含む可能性があるので、そもそも「公式」情報というものを作れないのかも知れない。

以前調べた内容: Linux の timezone

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?