LoginSignup
0

More than 5 years have passed since last update.

ISO 8601形式でUTCの現在時刻をサクッと表示する方法(with Docker)

Last updated at Posted at 2019-02-22

macOSのdateコマンドにISO 8601形式で表示するオプションがなかったので、Dockerのbusyboxイメージを使って現在時刻を表示します。
Dockerを使うことで、ポータビリティを高めます。

なお、busyboxなのでUTCでの表示になります。

docker run busybox date -Iseconds
実行結果(UTC)
2019-02-22T08:59:10+0000

追記

-I オプションを使わない場合はこちら。

docker run busybox date "+%Y-%m-%dT%H:%M:%S%z"

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