LoginSignup
1
1

More than 3 years have passed since last update.

タイムゾーン

Last updated at Posted at 2020-04-17

現在のタイムゾーンの確認

$ date
Fri Apr 17 11:51:41 UTC 2020

指定可能なタイムゾーン

/usr/share/zoneinfo/以下のファイル。
ディレクトリ構造の場合地域A/地域B。たとえば東京の場合はAsia/Tokyo

タイムゾーンの変更

環境変数で一時的に変更

$ export TZ="Asia/Tokyo"; date
Fri Apr 17 20:53:49 JST 2020

恒久的に変更

/usr/share/zoneinfo以下のファイルを/etc/localtimeにコピー、またはシンボリックリンクを張る。

cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

CentOSの場合

timedatectlを使用する。

$ timedatectl set-timezone Asia/Tokyo
$ timedatectl status

参考

1
1
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
1
1