0
2

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 3 years have passed since last update.

Linuxで時刻情報・timezoneを変更する方法

Last updated at Posted at 2021-06-15

実行環境

  • DegitalOcean
  • Ubunt==20.04.2

本題

linux環境でtimezoneを変換したい。

よくある話だと思います。

調べると、色んな記事があるのですが、私の環境で利用しているdegital oceanについて調べると、該当ファイルがなかったり、AWSやGCPとの違いが散見されました。一般的には、AWSやGCPを使う方が多いと思うので、そこまで汎用的な話ではないと思いますが、以下端的に解決方法をまとめます。

1.現在のタイムゾーンを確認する

terminal
cat /etc/timezone

現在、設定されているタイムゾーンが返されます。

terminal
Etc/UTC

2.使えるタイムゾーンを調べる

timedatectl list-timezones

使えるTimezone一覧が使用できます。

terminal(一部抜粋)
Asia/Tashkent
Asia/Tbilisi
Asia/Tehran
Asia/Tel_Aviv
Asia/Thimbu
Asia/Thimphu
Asia/Tokyo
Asia/Tomsk
Asia/Ujung_Pandang
Asia/Ulaanbaatar
Asia/Ulan_Bator
Asia/Urumqi
Asia/Ust-Nera
Asia/Vientiane

Asia/Tokyoが見つかると思います。

3.設定を変更

sudo timedatectl set-timezone Asia/Tokyo

Asia/Tokyoを変えれば適宜変更はできると思います。

参考資料

0
2
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?