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

[CentOS7]サーバのタイムゾーンの設定

Last updated at Posted at 2019-11-23

サーバの初期設定はUTCの設定になっているので、日本時間にする場合以下のコマンドを実行します。

<変更前>

# timedatectl
Local time: Sat 2019-11-23 01:12:28 UTC
Universal time: Sat 2019-11-23 01:12:28 UTC
RTC time: Sat 2019-11-23 01:12:22
Time zone: UTC (UTC, +0000)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

<日本時間へ変更>

# timedatectl set-timezone Asia/Tokyo

<変更後>

# timedatectl
Local time: Sat 2019-11-23 10:23:47 JST
Universal time: Sat 2019-11-23 01:23:47 UTC
RTC time: Sat 2019-11-23 01:23:41
Time zone: Asia/Tokyo (JST, +0900)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

設定可能なタイムゾーンを表示

# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa

タイムゾーンファイルの置き場所

# cd /usr/share/zoneinfo/
[root@ip-10-150-9-70 zoneinfo]# ll
total 392
drwxr-xr-x 2 root root 4096 Mar 5 2019 Africa
drwxr-xr-x 6 root root 8192 Mar 5 2019 America
drwxr-xr-x 2 root root 187 Mar 5 2019 Antarctica

※ファイルの中身を書き換えるとPHPの時間処理(Datetimeクラスなど)に影響が出るため慎重に検討する必要があります。

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