Open1

日時周りのまとめ

ohki_suguru.phpohki_suguru.php

ISO8601

日付と時刻の表記に関するISOの国際規格である

規格の主眼

  1. 日付と時刻の記述順序が国や文化によってまちまちである
  2. 大→小の順序(ビッグエンディアン big-endian)を貫徹させること
  3. 日付・時刻の記述順序をただ一種類に標準化していること

基本的な表記

  1. 年月日の区切り記号は「-」(ハイフン)のみ
  2. 「/」などを禁じている
  3. 時刻表現を24時制だけに限定
  4. タイムゾーンに対応
  5. 年は4桁(2桁では年が確定できない)
  6. 単位は基本的には秒まで(ミリ秒も可能だが桁数が定まっていないため)

2022年9月4日の時刻16時07分48.53秒

  1. 2022-09-04T16:07:48.53(拡張形式)
  2. 20220904T160748.53(基本形式)

記号 T で区切った後に時刻を続けるように表記する

規格の経緯

規格のこれまでの経緯は次のとおりである。

  1. ISO 2014:1976[4] Writing of calendar dates in all-numeric form
  2. ISO 8601:1988[5] Data elements and interchange formats — Information interchange — Representation of dates and times
  3. ISO 8601:2000[6] 同上
  4. ISO 8601:2004[7] 同上
  5. ISO 8601-1:2019 (Date and time -- Representations for information interchange -- Part 1: Basic rules)[8] および ISO 8601-2:2019 (Date and time -- Representations for information interchange -- Part 2: Extensions)[9] の2分冊(2019年2月発行。2021年時点の最新版)
  6. ISO 8601-1:2019/Amd 1:2022 (Date and time — Representations for information interchange — Part 1: Basic rules — Amendment 1: Technical corrections)[10]

参考

https://ja.wikipedia.org/wiki/ISO_8601