LoginSignup
339
240

More than 5 years have passed since last update.

日時のフォーマット(ISO 8601)

Last updated at Posted at 2014-11-22

日付や時間の情報をやり取りするフォーマットはいくつも存在します。
APIなどで利用するのにシンプルで分かりやすいものは ISO 8601 です。

ISO 8601

Format Time zone Sample Sample2
yyyy-MM-ddTHH:mm:ss 日本標準時(JST) 2014-10-10T13:50:40+09:00 20141010T135040+0900
~ 協定世界時(UTC) 2014-10-10T04:50:40Z 20141010T045040Z

ISO 8601 の中でも書き方は色々とありますが

  • 年月日と時間
  • タイムゾーンに対応
  • 年は4桁(2桁では年が確定できない)
  • 単位は秒まで(ミリ秒も可能だが桁数が定まっていないため)

という条件から利用しやすいフォーマットです。

利用実例

339
240
3

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
339
240