# ローカルタイム（タイムゾーン）の設定

**URL:** https://forum.ficusonline.com/t/topic/77
**Category:** Linux
**Created:** [2017 年 2 月 1 日午後 2:27 UTC](https://forum.ficusonline.com/t/topic/77 "2017-02-01T14:27:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2017 年 2 月 1 日午後 2:27 UTC](https://forum.ficusonline.com/t/topic/77/1 "2017-02-01T14:27:07Z")

</div>

NOTE: There’s also this option in Ubuntu 14.04 and higher with a single command (source: Ask Ubuntu - setting timezone from terminal):

> $ sudo timedatectl set-timezone Etc/GMT-6

```
On the use of "Etc/GMT+6"

```

Zones like Etc/GMT+6 are intentionally reversed for backwards compatibility with POSIX standards. See the comments in [this file](https://github.com/eggert/tz/blob/master/etcetera).

You should almost never need to use these zones. Instead you should be using a fully named time zone like America/New\_York or Europe/London or whatever is appropriate for your location. Refer to the list [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

東京に設定する場合は

> $ sudo timedatectl set-timezone Asia/Tokyo

---

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2020 年 4 月 16 日午前 2:31 UTC](https://forum.ficusonline.com/t/topic/77/2 "2020-04-16T02:31:04Z")

</div>

**Alpine Linux タイムゾーンの設定**

Alpine Linuxにはデフォルトでタイムゾーンの設定に必要なファイルがインストールされていないため、これらタイムゾーンファイルをインストールしてローカルタイム・ゾーンを東京に変更します。  
Dockerコンテナ内で稼働しているAlpine Linuxに適用します。

[https://wiki.alpinelinux.org/wiki/Setting\_the\_timezone](https://wiki.alpinelinux.org/wiki/Setting_the_timezone)

タイムゾーンファイルをインストールします。

```auto
apk add tzdata

```

タイムゾーン一覧

```auto
bash-5.0# ls /usr/share/zoneinfo
Africa Brazil EST GB HST Japan NZ Portugal UTC right
America CET EST5EDT GB-Eire Hongkong Kwajalein NZ-CHAT ROC Universal zone.tab
Antarctica CST6CDT Egypt GMT Iceland Libya Navajo ROK W-SU zone1970.tab
Arctic Canada Eire GMT+0 Indian MET PRC Singapore WET
Asia Chile Etc GMT-0 Iran MST PST8PDT Turkey Zulu
Atlantic Cuba Europe GMT0 Israel MST7MDT Pacific UCT iso3166.tab
Australia EET Factory Greenwich Jamaica Mexico Poland US posixrules

```

アジア地域主要都市のタイムゾーンファイル一覧

```auto
bash-5.0# ls /usr/share/zoneinfo/Asia
Aden Baku Colombo Ho_Chi_Minh Kashgar Magadan Pyongyang Singapore Ujung_Pandang
Almaty Bangkok Dacca Hong_Kong Kathmandu Makassar Qatar Srednekolymsk Ulaanbaatar
Amman Barnaul Damascus Hovd Katmandu Manila Qostanay Taipei Ulan_Bator
Anadyr Beirut Dhaka Irkutsk Khandyga Muscat Qyzylorda Tashkent Urumqi
Aqtau Bishkek Dili Istanbul Kolkata Nicosia Rangoon Tbilisi Ust-Nera
Aqtobe Brunei Dubai Jakarta Krasnoyarsk Novokuznetsk Riyadh Tehran Vientiane
Ashgabat Calcutta Dushanbe Jayapura Kuala_Lumpur Novosibirsk Saigon Tel_Aviv Vladivostok
Ashkhabad Chita Famagusta Jerusalem Kuching Omsk Sakhalin Thimbu Yakutsk
Atyrau Choibalsan Gaza Kabul Kuwait Oral Samarkand Thimphu Yangon
Baghdad Chongqing Harbin Kamchatka Macao Phnom_Penh Seoul Tokyo Yekaterinburg
Bahrain Chungking Hebron Karachi Macau Pontianak Shanghai Tomsk Yerevan

```

ローカルタイムとタイムゾーンをAsia/Tokyoに設定します。

```auto
bash-5.0# cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
bash-5.0# echo "Asia/Tokyo" > /etc/timezone

```

dateコマンドで現在時刻を確認します。

```auto
bash-5.0# date
Thu Apr 16 11:02:23 JST 2020

```

最後に不要なタイムゾーンファイルを全て削除します。

```auto
bash-5.0# apk del tzdata

```
