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

タイムゾーンを、日本の標準時に設定する

Last updated at Posted at 2020-01-06

はじめに

dateを実行すると、システムクロックが狂っていた。というよりも、タイムゾーンの設定が行えていないために、**UTC(協定世界時)**よりも9時間遅くなっていたので、日本の標準時に設定する事とする。日本の標準時は、協定世界時よりも、9時間時差があるため、UTC+09:00となる。

環境

Ubuntu 16.04.5 LTS

手順

現在の、タイムゾーンの設定を参照する。

$timedatectl

      Local time: Mon 2020-01-06 05:04:33 UTC
  Universal time: Mon 2020-01-06 05:04:33 UTC
        RTC time: Mon 2020-01-06 05:04:33
       Time zone: Etc/UTC (UTC, +0000)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no
```

日本の標準時が設定できる事を確認する。

```cmd
$timedatectl list-timezones | grep Tokyo

Asia/Tokyo
```

日本の標準時に設定する。

```cmd
$sudo timedatectl set-timezone Asia/Tokyo
```

正しく設定された事を確認する。

```cmd
timedatectl
      Local time: Mon 2020-01-06 14:06:12 JST
  Universal time: Mon 2020-01-06 05:06:12 UTC
        RTC time: Mon 2020-01-06 05:06:12
       Time zone: Asia/Tokyo (JST, +0900)
 Network time on: yes
NTP synchronized: no
RTC in local TZ: no
```

システムクロックが正しく表示される事を確認する。

```cmd
date
```

ハードウェアクロックを確認すると、一緒に直っていた。

```cmd
hwclock -r
```

# 参考記事

https://qiita.com/koara-local/items/32b004c0bf80fd70777c

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