-
Notifications
You must be signed in to change notification settings - Fork 4
/
208.txt
1681 lines (1275 loc) · 80.4 KB
/
208.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[6] [DFN[[[ISO 8601]]]] は、[[日付]]と[[時刻]]の表現形式に関する [[ISO]] の[[国際標準]]です。
[[日時]]の[[情報交換]]に使えるいくつかの[[構文]] ([[日時形式]]) を定義しています。
[EG[
[182] 例えば[[グレゴリオ暦]]の[[西暦]][TIME[2016年3月25日][2016-03-25]]を [CODE[2016-03-25]]
と表現できる、といったことが規定されています。
]EG]
[168] [[ISO 8601]] は、[[日時]]に関する様々な対象を記述したり、様々な応用分野で利用したりできるように、
多くの選択肢のある“緩い”仕様を提示しています。実際には、利用する場面ごとにより具体的な仕様を
([[情報交換の当事者間の合意]]により) 確定する必要があり、それを[[プロファイル][ISO 8601のプロファイル]]と呼ぶことがあります。
[[ISO 8601のプロファイル]]は、色々な場面で使われています。
[175] [[自然言語]]文では、歴史と文化により様々な[[日時表現][日時表示]]が用いられています。
しかし[[日米欧]]で[[年月日]]の順序が異なるなど、その表記の揺れは大きく、
[[相互運用可能]]な[[情報交換]]のためには何らかの基準が必要です。
[[ISO 8601]] はそのような基準として色々な場面で採用されています。
[NOTE[
[176] しかし、いつでもどこでもむやみに [[ISO 8601]] の日時形式を採用するべきとも言えません。
例えば [[ISO 8601]] の規定に従えば日付と時刻の間には「T」と記載することになります
([TIME[2016年3月25日の12時18分][2016-03-25T12:18]]は
[CODE[2016-03-25[[T]]12:18]] と表記します。) が、
[[人間]]が対象読者なら、この表記は一般的ではありませんから、奇妙に思われるでしょう。
[[時刻]]を「'''t'''ime」と呼ぶ[[英語圏]]ですら、この表記は (人間対象には) 普及していません。
[248]
一部で誤解があるような、すべての[[日時表示]]を統一しようと志向するものではありませんし、
そのような施策も知られていません。
]NOTE]
* 仕様書
[REFS[
- [7] '''[[ISO 8601]]'''
-- [38] [CITE@en[Home]]
([TIME[2013-12-10 08:40:33 +09:00]] 版))
<http://www.iso.org/iso/iso8601>
- [27] [[JIS X 0301]]: ISO 8601 に対応 ([[MOD]]) する [[JIS]]
]REFS]
[37] [[ISO 8601]] は >>38 から入手できますが、有料です。
;; [247] 本気で普及させようとしているのでしょうか?
[[規格票]]の販売で[[標準化]]する[[ビジネスモデル]]が過去のものになってもはや何十年も経過しています。
** 表記法
[45] [[ISO 8601]] では[[地の文]]と[[日時表現]]や[[日時書式表現]]を区別するために、
[RUBYB[表現]@en[representation]]を「[」と「]」で括っています。この括弧は仕様書の表現上のもので、
表現の一部ではないとされています。 [SRC[>>7 Introduction]]
[244] 実際 [[ISO 8601]] 以外でこの表記法はあまり見かけません。
* 暦法
[219]
[[ISO 8601]] は[[先発グレゴリオ暦]]を採用しています。
[SEE[ [[先発グレゴリオ暦]]、[[グレゴリオ暦]]、[[ISO 8601の年]] ]]
[250]
[[ISO 8601]] 本体は[[西暦年]]にだけ対応しています。
他の[[紀年法]]は利用できません。
[251]
ただし [[ISO 8601]]
の各国版は、
当該国の[[紀年法]]に対応している場合があります
(>>234)。
* 表現
[126] [[ISO 8601]] は[[日時などを記述した文字列][日時形式]]のことを[DFN[[RUBYB[表現]@en[representation]]]]と呼んでいます。
[[ISO 8601]] では次のような[[表現][表現 (ISO 8601)]]が定義されています。
[FIG[
- [[日時表現]]
-- 日付の表現
-- 時刻の表現
-- 時差の表現
-- 日時の表現
-- 時間長の表現
-- 時間間隔の表現
-- 反復時間間隔の表現
- [[日時書式表現]]
]FIG]
[26] [DFN[[RUBYB[[[日時表現]]]@en[date and time representation]]]]は、
[[時間点]]や[[時間間隔]]、[[反復時間間隔]]を示す[RUBYB[表現]@en[representation]]です [SRC[>>7 2.3.1]]。
[36] [[日時表現]]は精度や値域によって次のように分類されています。
[FIG[
- [32] [DFN[[RUBYB[[[完全表現]]]@en[complete representation]]]]は、
当該表現を構成するすべての日時の要素を含めた表現です。 [SRC[>>7 2.3.5]]
-- 要素としてはすべて含まれますが、5桁以上の年や小数部は含まれません。
- [33] [DFN[[RUBYB[[[小数付き表現]]]@en[decimal representation]]]]は、
構成する下位の部品に[[小数]]を加えたものです。 [SRC[>>7 2.3.6]]
- [34] [DFN[[RUBYB[[[精度を削減した表現]]]@en[representation with reduced accuracy]]]]は、
下位の部品を省略したものです。 [SRC[>>7 2.3.7]]
- [35] [DFN[[RUBYB[[[展開表現]]]@en[expanded representation]]]]は、
0年より前や9999年より後の[[暦年]]を表現できるようにしたものです。 [SRC[>>7 2.3.8]]
- [141] [DFN[[RUBYB[[[切り詰めた表現]]]@en[truncated representation]]]]は、
構成する上位の部品を省略したものです。 [SRC[[[ISO 8601:2000]] 4.6]]
-- [[ISO 8601:2004]] では削除されています。
]FIG]
[127] [[完全表現]]は、週による表記と月日による表記のように、複数存在することがあります。
それ以外の表現も、月までの精度の表現と年までの精度の表現のように、複数存在することがあります。
月までの精度で年を展開した表現のように、複数に該当する表現もあり得ます。
[130] 複数の表現を組み合わせて構成される表現では、違った精度の表現を混在させることができます。
例えば[[日時]]を表す際に、[[日付]]の[[完全表現]]と[[時刻]]の[[精度を削減した表現]]を組み合わせることができます
(もちろんそれは[[日時]]の[[完全表現]]ではありません)。
[69] また記号の有無によって次の分類があります。
[FIG[
- [29] [DFN[[RUBYB[[[基本書式]]]@en[basic format]]]]は、
要求される精度に必要なだけの最小の時刻要素により構成される[[日時表現]]または[[日時書式表現]]の書式です
[SRC[>>7 2.3.3]]。
- [31] [DFN[[RUBYB[[[拡張書式]]]@en[extended format]]]]は、
[[基本書式]]に追加の[[分離子]]を含めて拡張したものです [SRC[>>7 2.3.4]]。
]FIG]
;; [30] [[基本書式]]は、[[平文]]では避けるべきです [SRC[>>7 2.3.3 NOTE]]。
[128] [[基本書式]]と[[拡張書式]]がある場合、[[拡張書式]]から特定の[[分離子]]を除去したものが[[基本書式]]になっています。
除去できる[[分離子]]がない場合には、[[拡張書式]]はありません。
[131] 複数の表現を組み合わせて構成される表現では、[[基本書式]]と[[拡張書式]]を混在させることは禁止されています。
;; [132] [[24時間制]]の普及によって[[分離子]]は必要なくなった [SRC[>>7 Annex A]]
という見方により、[[数字]]のみで構成される方が「基本」で、[[分離子]]が含まれる方が「拡張」
とされているようです。
(この考え方が世間一般で通用するかは甚だ疑問です。)
[129] 表現や書式の種類は沢山ありますが、基本的にはどれが良いとかどれが優れているといったような区別ではなく、
必要に応じて使い分けることが想定されているようです。
[160] [[ISO 8601//ABNF]] に、[[日時表現]]を [[ABNF]] で表したものがあります。
* 日時書式表現
[28] [DFN[[RUBYB[[[日時書式表現]]]@en[date and time format representation]]]]は、
[[日時表現]]の群の書式を説明する[RUBYB[表現]@en[representation]]です [SRC[>>7 2.3.2]]。
[46] これは一種のパターン言語で、 [[ISO 8601]] 仕様書で[[日時表現]]の構文を定義する [SRC[>>7 3.3]]
ためのものですが、[[情報交換]]において[[日時表現]]がどのように記述されているかを示すために用いることもできます。
[EG[
[147] 例えば [CODE[YYYY-MM]] という[[日時書式表現]]は、 [CODE[2000-03]] や
[CODE[1985-12]] や [CODE[0003-01]] などの年月の[[日時表現]]を表しています。
]EG]
[47] [[情報交換の当事者間の合意]]により、[[日時書式表現]]を転送しても構いません [SRC[>>7 3.3, >>7 5]]。
その場合 [[ISO 8601]] により認められた[[日時書式表現]]のみを用いなければなりません [SRC[>>7 3.3]]。
また、[[情報交換の当事者間の合意]]により認められた[[日時表現]]に対応する[[日時書式表現]]のみ用いなければなりません
[SRC[>>7 5]]。
[51] [[ITU-T S.1]] [[レパートリ]] ([[telex]] など) を用いる環境では、
[[日時書式表現]]を用いてはなりません。 [SRC[>>7 3.4.1]]
[54] [[日時書式表現]]では、次の[[文字]]を使います [SRC[>>7 3.4.2]]。
,*[[文字]],*意味
,[CODE[[[Y]]]],[[年]]の[[数字]]
,[CODE[[[M]]]],[[月]]の[[数字]]
,[CODE[[[D]]]],[[日]]の[[数字]]
,[CODE[[[w]]]],[[週]]の[[数字]]
,[CODE[[[h]]]],[[時]]の[[数字]]
,[CODE[[[m]]]],[[分]]の[[数字]]
,[CODE[[[s]]]],[[秒]]の[[数字]]
,[CODE[[[n]]]],[[正数]]または[[0]]の[[数字]]
[55] [CODE[[[±]]]] は、[[正数]]または[[0]]の [CODE[[[+]]]] または[[負数]]の[[マイナス]]を表します
[SRC[>>7 3.4.2]]。ただし [CODE[[[±]]]] を使えない環境では、[[日時書式表現]]に
[CODE[[[±]]]] を含められません [SRC[>>7 3.4.1]]。
;; [86] [[0]] を表すために[[マイナス]]を用いることは認められていません。
[48] [[下線]]は、[[日時表現]]においてそれに相当する部分が複数文字に展開され得ることを表します [SRC[>>7 3.3]]。
>>54 の[[数字]]を表す[[文字]]に[[下線]]があると、それが0[[文字]]以上であることを表します [SRC[>>7 3.4.2]]。
[[日時書式表現]]の[[情報交換]]の時点で文字数がわかっている時には、[[下線]]を用いてはなりません [SRC[>>7 3.3, >>7 5]]。
[[文字]]に[[下線]]を付けられない環境では、[[文字]]の前に[[下線]]を置かなければなりません [SRC[>>7 3.4.1]]。
[EG[
[245] 例えば [CODE[n[U[n]]]] や [CODE[n_n]] は、1桁以上の[[数字]]で[[非負整数]]を記述したものです。
]EG]
[56] その他の[[文字]]は、[[日時表現]]でも同じ[[文字]]を表します [SRC[>>7 3.4.2]]。
[133] [[JIS X 0301]] による拡張では、 [CODE[[[N]]]] が[[元号]]の記号を表します [SRC[>>27 5.1.3]]
* 日付の表現
[70] [[暦日付]]に関しては、次の表現が定義されています [SRC[>>7 4.1.2]]。
, ,[[基本形式]] ,[[拡張形式]]
,[[完全表現]] - [[日]] ,[CODE[YYYYMMDD]] ,[CODE[YYYY‐MM‐DD]]
,[[精度を削減した表現]] - [[月]] ,[CODE[YYYY‐MM]] ,なし
,[[精度を削減した表現]] - [[年]] ,[CODE[YYYY]] ,なし
,[[精度を削減した表現]] - [[世紀]] ,[CODE[YY]] ,なし
,[[展開表現]] - [[日]] ,[CODE[±_YYYYYMMDD]] ,[CODE[±_YYYYY‐MM‐DD]]
,[[展開表現]] - [[精度を削減した表現]] - [[月]] ,[CODE[±_YYYYY‐MM]] ,なし
,[[展開表現]] - [[精度を削減した表現]] - [[年]] ,[CODE[±_YYYYY]] ,なし
,[[展開表現]] - [[精度を削減した表現]] - [[世紀]] ,[CODE[±_YYY]] ,なし
[72] [[通日日付]]に関しては、次の表現が定義されています [SRC[>>7 4.1.3]]。
, ,[[基本形式]] ,[[拡張形式]]
,[[完全表現]] - [[日]] ,[CODE[YYYYDDD]] ,[CODE[YYYY‐DDD]]
,[[展開表現]] - [[日]] ,[CODE[±_YYYYYDDD]] ,[CODE[±_YYYYY‐DDD]]
[73] [[週日付]]に関しては、次の表現が定義されています [SRC[>>7 4.1.4]]。
, ,[[基本形式]] ,[[拡張形式]]
,[[完全表現]] - [[日]] ,[CODE[YYYYWwwD]] ,[CODE[YYYY‐Www‐D]]
,[[精度を削減した表現]] - [[週]] ,[CODE[YYYYWww]] ,[CODE[YYYY‐Www]]
,[[展開表現]] - [[日]] ,[CODE[±_YYYYYWwwD]] ,[CODE[±_YYYYY‐Www‐D]]
,[[展開表現]] - [[精度を削減した表現]] - [[週]] ,[CODE[±_YYYYWww]] ,[CODE[±_YYYY‐Www]]
;; [74] 「[CODE[W]]」はそのまま[[日時表現]]に現れます。
[HISTORY[
[142] 以前は更に次の表現が定義されており、[[情報交換の当事者間の合意]]により用いることができました
[SRC[[[ISO 8601:2000]] 5.2.1.3, 5.2.2.2, 5.2.3.3]]。
,* ,*[[基本形式]] ,*[[拡張形式]]
,[[切り詰めた表現]] - [[世紀]]省略 ,[CODE[YYMMDD]] ,[CODE[YY‐MM‐DD]]
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[世紀]]省略 ,[CODE[‐YYMM]] ,[CODE[‐YY‐MM]]
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[世紀]]省略 ,[CODE[‐YY]] ,なし
,[[切り詰めた表現]] - [[年]]省略 ,[CODE[--MMDD]] ,[CODE[‐‐MM‐DD]]
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[年]]省略 ,[CODE[‐‐MM]] ,なし
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[年]][[月]]省略 ,[CODE[‐‐‐DD]] ,なし
,[[切り詰めた表現]] - [[世紀]]省略 ,[CODE[YYDDD]] ,[CODE[YY‐DDD]]
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[年]]省略 ,[CODE[‐DDD]] ([CODE[‐]] 1つ!),なし
,[[切り詰めた表現]] - [[世紀]]省略 ,[CODE[YYWwwD]] ,[CODE[YY‐Www‐D]]
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[世紀]]省略 ,[CODE[YYWww]] ,[CODE[YY‐Www]]
,[[切り詰めた表現]] - [[十年紀]]省略 ,[CODE[-YWwwD]] ,[CODE[‐Y‐Www‐D]]
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[十年紀]]省略 ,[CODE[‐YWww]] ,[CODE[‐Y‐Www]]
,[[切り詰めた表現]] - [[年]]省略 ,[CODE[‐WwwD]] ,[CODE[‐Www‐D]]
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[年]]省略 ,[CODE[‐Www]] ,なし
,[[切り詰めた表現]] - [[週]]省略 ,[CODE[‐W‐D]] ,なし
[143] これらの先頭の省略を表す [CODE[‐]] は、
曖昧でない場合省略できる
[SRC[[[ISO 8601:2000]] 4.6, 5.2.1.3, 5.2.2.2, 5.2.3.3]]
とされていました。
]HISTORY]
[135] [[JIS X 0301]] は[[元号]]による[[日付]]の表現も定義しています [SRC[>>27 5.2.4]]
, ,[[基本形式]] ,[[拡張形式]]
,[[完全表現]] - [[日]] ,[CODE[YY.MM.DD]] ,[CODE[NYY.MM.DD]]
;; [136] ここで [CODE[.][FULL STOP]] は[[小数点]]ではなく、
[[ピリオド]] [SRC[>>27 5.2.4]] とされています
(>>139)。
;; [137] [[完全表現]]以外は定義されていないようです。また、他の表現との組み合わせも定義されていないようです。
([[日時]]を組み合わせた表現すら定義されていませんが、いいのでしょうか。。。)
[319]
[CITE@ja[ISO8601(X0301)の桁数拡張: suchowan's blog]], [TIME[2022-04-26T03:01:05.000Z]] <https://suchowan.at.webry.info/201309/article_6.html>
[320]
[CITE@ja[ISO8601(X0301)用オプション: suchowan's blog]], [TIME[2022-04-27T06:17:51.000Z]] <https://suchowan.at.webry.info/201312/article_11.html>
* 時の表現
[75] [[地方時]]に関しては、次の表現が定義されています [SRC[>>7 4.2.2]]。
, ,[[基本形式]] ,[[拡張形式]]
,[[完全表現]] - [[秒]] ,[CODE[hhmmss]] ,[CODE[hh:mm:ss]]
,[[精度を削減した表現]] - [[分]] ,[CODE[hhmm]] ,[CODE[hh:mm]]
,[[精度を削減した表現]] - [[時]] ,[CODE[hh]] ,なし
,[[小数付き表現]] - [[秒]] ,"[CODE[hhmmss,s_s]] ","[CODE[hh:mm:ss,s_s]]"
,[[小数付き表現]] - [[精度を削減した表現]] - [[分]],"[CODE[hhmm,m_m]]","[CODE[hh:mm,m_m]]"
,[[小数付き表現]] - [[精度を削減した表現]] - [[時]],"[CODE[hh,h_h]]",なし
[144] 以前は更に次の表現が定義されており、[[情報交換の当事者間の合意]]により用いることができました
[SRC[[[ISO 8601:2000]] 5.3.1.4]]。
, ,[[基本形式]] ,[[拡張形式]]
,[[切り詰めた表現]] - [[時]]省略 ,[CODE[‐mmss]] ,[CODE[‐mm:ss]]
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[時]]省略 ,[CODE[‐mm]] ,なし
,[[切り詰めた表現]] - [[精度を削減した表現]] - [[分]]省略 ,[CODE[‐‐ss]] ,なし
,[[切り詰めた表現]] - [[小数付き表現]] - [[時]]省略 ,"[CODE[‐mmss,s_s]]","[CODE[‐mm:ss,s_s]]"
,[[切り詰めた表現]] - [[小数付き表現]] - [[精度を削減した表現]] - [[時]]省略 ,"[CODE[‐mm,m_m]]",なし
,[[切り詰めた表現]] - [[小数付き表現]] - [[精度を削減した表現]] - [[分]]省略 ,"[CODE[‐‐ss,s_s]]",なし
[145] なおこれらの先頭の省略を表す [CODE[[[-]]]] は、曖昧でない場合省略できるとされていました
[SRC[[[ISO 8601:2000]] 4.6, 5.3.1.4]]。
[81] [RUBYB[[[日のUTC]]]@en[UTC of day]]に関しては、 >>75 の各表現の後に
[DFN[[RUBYB[[[UTC指示子]]]@en[UTC designator]]]] [DFN[[CODE[[[Z]]]]]]
を付けたものが定義されています [SRC[>>7 4.2.4]]。
[87] [[地方時]]と、[[地方時]]と[[UTC]]の[[時差]]を示す必要がある時は、
[[地方時]]の直後に[[時差]]の表現を続けることができます [SRC[>>7 4.2.5.2]]。
[90] [[地方時]]においては[[空文字列]]、[[日のUTC]]においては [[UTC指示子]] [CODE[[[Z]]]]、
[[時差]]付きの場合においては[[時差]]のことを[DFN[[RUBYB[[[時間帯指示子]]]@en[zone designator]]]]といいます
[SRC[>>7 4.3.2]]。
[76] [[地方時]]の表現 (>>75) の前に[[時刻指示子]] [DFN[[CODE[[[T]]]]]] を付けた[DFN[[RUBYB[時刻指示子付き表現]@en[representation with time designator]]]]を用いることができます。
文脈上[[地方時]]の表現であるか不明瞭な場合には、これを用いなければなりません。 [SRC[>>7 4.2.2.5]]
;; [82] [[日のUTC]]の表現 (>>81) や[[時差]]付きの表現 (>>87) と[[時刻指示子]]の併用については言及がありません。
([[UTC指示子]]や[[時差]]により明確に[[時刻]]と判断できるからでしょうか。)
[194] [[閏秒]]もあります。
* 時差の表現
[83] [[地方時]]と[[日のUTC]]の[[時差]]に関しては、次の表現が定義されています [SRC[>>7 4.2.5.1]]。
, ,[[基本形式]] ,[[拡張形式]]
,[[分]] ,[CODE[±hhmm]] ,[CODE[±hh:mm]]
,[[時]] ,[CODE[±hh]] ,なし
[85] [[地方時]]の表現とは違って、[[分]]を省略できるのは、[[分]]が 0 になるときだけです [SRC[>>7 4.2.5.1]]。
[[精度を削減した表現]]や[[小数付き表現]]はありません。
[84] [[時差]]は[[地方時]]の表現と併用するもので、単独での利用は禁止されています [SRC[>>7 4.2.5.1]]。
;; [185] [[RFC 3339の日時形式]]は [CODE[-00:00]] に特別な意味を与えていますが、
[[ISO 8601]] にはそのような規定はなく、[[ローカルルール]]です。
(そうしたローカルルールが [[ISO 8601]] により認められるかどうか、
議論の余地があります。)
* 日時の表現
[88] [[日時]]に関しては、次のいずれかの[[日付]]の表現 ([[完全表現]]または[[展開表現]])
の後に[[時刻指示子]] [CODE[[[T]]]] の後に >>75、>>81、>>87 のいずれかの[[時刻]]の表現が来るものが定義されています
[SRC[>>7 4.3]]。
,[[基本形式]] ,[[拡張形式]]
,[CODE[YYYYMMDD]] ,[CODE[YYYY‐MM‐DD]]
,[CODE[±_YYYYYMMDD]] ,[CODE[±_YYYYY‐MM‐DD]]
,[CODE[YYYYDDD]] ,[CODE[YYYY‐DDD]]
,[CODE[±_YYYYYDDD]] ,[CODE[±_YYYYY‐DDD]]
,[CODE[YYYYWwwD]] ,[CODE[YYYY‐Www‐D]]
,[CODE[±_YYYYYWwwD]] ,[CODE[±_YYYYY‐Www‐D]]
;; [161] [[日付]]に[[精度を削減した表現]]を使うことはできません。 ([[時刻]]では使えます。)
;; [162] [[ISO 8601:2000]] では、[[日付]]に[[切り詰めた表現]]が認められていました
[SRC[[[ISO 8601:2000]] 5.4.2]]。 ([[時刻]]では使えません。)
;; [89] [[日時]]共に[[完全表現]]であるものが、[[日時]]の[[完全表現]]です [SRC[>>7 4.3.2]]。
[91] [[時刻指示子]] [CODE[[[T]]]] は、[[情報交換の当事者間の合意]]があれば、
曖昧でない場合省略できます。 [SRC[>>7 4.3.2 NOTE]]
[92] [[日時]]の[[基本形式]]と[[拡張形式]]を混在させることはできません [SRC[>>7 4.3.3]]。
* 時間長の表現
[100] [DFN[ISO 8601の時間長形式]]としては、次の表現が定義されています [SRC[>>7 4.4.3]]。
[FIG(list)[
- [[完全表現]] [CODE[Pn_nW]]
- [[完全表現]] [CODE[Pn_nYn_nMn_nDTn_nHn_nMn_nS]]
- [[精度を削減した表現]] [[情報交換の当事者間の合意]]により、下位の部品を省略できます
- [[小数付き表現]] [[情報交換の当事者間の合意]]により、下位の部品に[[小数点]]と[[小数部]]を含められます
]FIG]
[105] 値が0なら、その値と直後の[[指示子]]は省略できます。[[時]]と[[分]]と[[秒]]がすべて省略されるなら、
[CODE[[[T]]]] も省略しなければなりません。しかしすべて省略して [CODE[[[P]]]]
のみとしてはなりません。 [SRC[>>7 4.4.3.2]]
[104] 数字列が、その直後の[[指示子]]を単位とする[[時間長]]の値と解釈されます。
全体としては個々の[[時間長]]の[[和]]を表します。
[103] 数字列の最大桁数は、[[情報交換の当事者間の合意]]によります [SRC[>>7 4.4.3.2]]。
[101] [[時間長]]の表現は[[時間間隔]]や[[循環時間間隔]]の一部として使われるもので、
単独での利用を推進するものではない [SRC[>>7 4.4.3.2]] とされています。
;; [102] 実際にはむしろ[[時間間隔]]よりも[[時間長]]単独での方が用いられているようです。
** 代替形式
[107] [[情報交換の当事者間の合意]]により、[RUBYB[代替形式]@en[alternative format]]を用いることもできます。
これは日時の表現の前に [CODE[[[P]]]] を付けたものです。 [SRC[>>7 4.4.3.3]]
- [[暦日付]] [CODE[PYYYY‐MM‐DD]]
- [[通日日付]] [CODE[PYYYY‐DDD]]
- [[地方時]] [CODE[PThh:mm:dd]]
- [[暦日付]]の[[日時]] [CODE[PYYYY‐MM‐DDThh:mm:dd]]
- [[通日日付]]の[[日時]] [CODE[PYYYY‐DDDThh:mm:dd]]
[108] ここに示したものの他に、[[基本書式]]、[[精度を削減した表現]]、[[小数付き表現]]、[[展開表現]]も認められているようです。
;; [165] [[展開表現]]で[[負]]の[[年]]は意味をなさなそうですが、それも認められているのかは不明です。
[109] ただしこれらは日付としてではなく、[[時間長]]として扱われるため、値域が違っています。
[[年]]、[[月]]、[[日]]は 0 から始まります。また 12月、30日、24時、60分、60秒は認められないようです。
[SRC[>>7 4.4.3.3]]
;; [110] [[通日日付]]の場合が明記されていませんが、364日までOKでしょうか。[[暦日付]]との整合性を考えると
359日までOKかもしれません。
;; [119] [[週]]による表記が認められていないのは、1年が52週か53週か決められないから
[SRC[>>7 4.4.3.3 NOTE]] とされています。
** 派生
[242] [CODE[TM_PeriodDuration]]
は [[ISO 8601の時間長形式]]を使った[[データ型]]です。
構文を制限し、[[グレゴリオ暦]]と [[UTC]] 以外にも拡張しています。
* 時間間隔の表現
[93] [DFN[ISO 8601の時間間隔形式]]は、
- [94] 開始と終了 [SRC[>>7 4.4.1 a)]]
- [95] [[時間長]]と文脈 [SRC[>>7 4.4.1 b)]]
- [96] 開始と[[時間長]] [SRC[>>7 4.4.1 c)]]
- [97] [[時間長]]と終了 [SRC[>>7 4.4.1 d)]]
... の4種類の方法で記述できます [SRC[>>7 4.4.1]]。このうち >>94、>>96、>>97 は完結した情報ですが、
>>95 は[[時間]]のみで構成される不完全な [[time interval]] 情報で、
その意味を解釈するためには何らかの文脈情報が必要です。
[FIG(railroad)[
= |
== =
=== [[日時]]
=== [CODE(URI)[[[/]]]]
=== |
==== [[日時]]
==== [[時間長]]
== =
=== [[時間長]]
=== ?
==== [CODE(URI)[[[/]]]]
==== [[日時]]
]FIG]
** 開始と終了による表現
[111] [[日時]]の表現を、開始と終了で2つ並べて、[CODE[[[/]]]] で区切ったものです。
[112] すべて[[基本書式]]、またはすべて[[拡張書式]]で構成されなければなりません [SRC[>>7 4.4.4.1, >>7 4.4.4.5, >>7 4.4.5]]。
[113] 両者の前後関係は明記されていませんが、開始と終了ですから、前者が後者以下でなければならないものと思われます。
[121] 終了側の上位側が省略されていれば、開始側と同じ値とみなされます [SRC[>>7 4.4.5]]。
[EG[
[122] 例えば [CODE[1985-04-12/06-25]] は、1985年4月12日から1985年6月25日を表します [SRC[>>7 B.1.4]]。
]EG]
;; [124] 省略の仕方によっては何を表すのかわからなくなりますが、どこまで省略できるのか、
どう解釈するべきなのかは記述されていません。例えば[[基本書式]]で上位を省略したものと下位を省略したものは区別がまったくできないケースがあります。
また[[拡張書式]]でも、[[時]]まで省略して分と秒だけのものと、 [CODE[T]] まで省略して時と分だけで秒がないものは、
区別できないケースが有ります。
;; [159] 流石に日時とも省略されて[[時差]]だけ残るケースは認められないと思うのですが、どうでしょうか。
[120] 開始側に[[UTC指示子]]か[[時差]]が含まれていて、終了側に含まれていなければ、
開始側の[[時間帯]]が終了側にも適用されます [SRC[>>7 4.4.5]]。
[123] 精度を削減する時に前後で精度が一致していなければならないという規定はありませんから、
[CODE[1098-01-05/1993-03-05T00:12:44]] のような表現も良いことになります。
-*-*-
[308] [[RKMSの時間範囲形式]]は、不明を表すために開始と終了の一方を省略可能とした拡張でした。
[309] [[Date Ranges (Dublin Core)]] は、 [[W3C-DTF]]
に限定しつつ、開始と終了の一方を省略可能とした拡張でした。
** 時間長と文脈による表現
[114] [[時間長]]の表現によって、[[時間間隔]]の表現とするものです [SRC[>>7 4.4.4.2, >>7 4.4.4.5, >>7 4.4.5]]。
** 開始と時間長による表現
[115] 開始の[[日時]]の表現と[[時間長]]の表現を並べて、 [CODE[[[/]]]] で区切ったものです。
[116] すべて[[基本書式]]、またはすべて[[拡張書式]]で構成されなければなりません [SRC[>>7 4.4.4.3, >>7 4.4.4.5, >>7 4.4.5]]。
** 時間長と終了による表現
[117] [[時間長]]と終了の[[日時]]の表現を並べて、 [CODE[[[/]]]] で区切ったものです。
[118] すべて[[基本書式]]、またはすべて[[拡張書式]]で構成されなければなりません [SRC[>>7 4.4.4.4, >>7 4.4.4.5, >>7 4.4.5]]。
* 反復時間間隔の表現
[125] [[反復時間間隔]]は、 [CODE[[[R]]]]、反復数、[CODE[[[/]]]]、[[時間間隔]]の順に並べて表現します。
反復数を省略した場合は、無制限の反復を表します。 [SRC[>>7 4.5]]
[FIG(railroad)[
= [CODE[[[R]]]]
= 数
= [CODE[[[/]]]]
= [[時間間隔]]
]FIG]
* 指示子
[57] [[日時表現]] (や[[日時書式表現]]) には[[ラテン文字]]がしばしば登場しますが、
これは[RUBYB[[[指示子]]]@en[designators]] [SRC[>>7 3.4.3]] と呼ばれています。
;; [148] [CODE[[[P]]]],[CODE[[[R]]]], [CODE[[[T]]]], [CODE[[[W]]]], [CODE[[[Z]]]]
が使われています [SRC[>>7 3.4.3]]。
[58] 更に[[時間]]の表現では、
[CODE[[[Y]]]], [CODE[[[M]]]], [CODE[[[W]]]], [CODE[[[D]]]], [CODE[[[H]]]], [CODE[[[S]]]]
が[[指示子]]として使われます [SRC[>>7 3.4.3]]。
;; [149] [CODE[[[M]]]] は[[月]]としても[[日]]としても使われます。
;; [59] [CODE[[[Y]]]], [CODE[[[M]]]], [CODE[[[D]]]] は[[日時書式表現]] (>>54) では違う意味になっています。
[134] [[JIS X 0301]] の拡張では、
[CODE[M]]、[CODE[明]]など (>>172)
を[[元号]]を表す記号として使っています [SRC[>>27 5.1.3]]。
;; [138] [[ラテン文字]]と[[漢字]]の使い分けは、定義されていません。
* 先導0
[65] [[時刻]]要素で長さが決まっている場合には、必要なら[[先導0]]を用いなければなりません
[SRC[>>7 3.6]]。
[71] 可変長の部分では[[先導0]]は禁止されていないようです。
[163] [[先導0]]によって解釈が曖昧となることもあります。
[EG[
[164] 例えば25[[世紀]]を表す [CODE[25]] の[[展開表現]]である [CODE[+0025]] は、
25[[年]]を表す [CODE[0025]] の[[展開表現]]である [CODE[+0025]] と区別できません。
]EG]
* 文字と記号
[150] [[日時書式表現]]における [CODE[[[±]]]] (>>55)、 [CODE[[[/]]]] の代替の[[ダブルハイフン]] (>>98)、
特殊な扱いである[[ハイフン]]と[[マイナス]] (>>49)、 [[JIS X 0301]] による拡張である[[元号]] (>>134)
という多くの例外を除き、 [[ISO 8601]] の表現で用いられる[[文字]]は、 [[ISO/IEC 646]] や
[[ASCII]] で表現できます。
[52] [[日時表現]]では、[[大文字]]が使えない場合、[[小文字]]を使って構いません。
[SRC[>>7 3.4.1 NOTE 1]]
;; [60] [[日時書式表現]]では[[大文字]]と[[小文字]]の違いによって意味が変わることがあります。
[53] [RUBYB[[[空白]]]@en[space]]は、明示的に認められた場合を除き、使ってはなりません。
[SRC[>>7 3.4.1]] ただし [[ISO 8601]] で明示的に認めている箇所はありません。
[63] [CODE[[[:]]]] は、[[時]]、[[分]]、[[秒]]の区切りに使います [SRC[>>7 3.4.4]]。
;; [140] [[ISO 8601:2000]] では [CODE[#]] も定義されています [SRC[[[ISO 8601:2000]] 4.5]] が、例示にあるだけで、
実際には利用されていません。[[反復時間間隔]]において何度目の反復であるかを識別する際の区切子として使うことが想定されていたようです。
[[ISO 8601:2004]] には含まれていません。
** ハイフンとマイナス
[61] [[マイナス]]は、[[日時書式表現]]の [CODE[[[±]]]] に相当する[[日時表現]]の部分で使って、
[[負数]]を表します。
[62] [[ハイフン]]は、[[年]]、[[月]]、[[週]]、[[日]]の間の区切りとして使います [SRC[>>7 3.4.4]]。
[49] [[ハイフン]]や[[マイナス]]は、 [[ISO/IEC 646]] を元にした[[文字レパートリ]]にあっては、
[CODE(charname)@en[[[HYPHEN-MINUS]]]] を用います。 [SRC[>>7 3.4.1]]
;; [50] [[ISO/IEC 10646]] や [[Unicode]] がそのような[[文字レパートリ]]と言えるのかは不明です...
** 小数点
[77] [[小数点]]は[[時]]、[[分]]、[[秒]]の[[整数部]]と[[小数部]]を分けるために使います。
値が1に満たない時は[[整数部]]を 0 や 00 にしなければなりません。
[[小数点]]がある時は[[小数部]]は1桁以上必要です。 [SRC[>>7 4.2.2.4, >>7 4.4.3.2]]
[78] [[小数点]]は [CODE[[[,]]]] または [CODE[.][FULL STOP]] を用いることができます。
[CODE[[[,]]]] が[RUBYB[より好ましい]@en[preferred]]とされています。 [SRC[>>7 4.2.2.4, >>7 4.4.3.2]]
[79] [[ISO 8601]] の[[日時書式表現]]や例示の[[日時表現]]はすべて [CODE[[[,]]]]
に統一されています。
[80] しかし [[XML Schemaの日付形式]]や[[HTMLの日付形式]]など主要なプロファイルはすべて
[CODE[.][FULL STOP]] を採用しています。
[139] [[JIS X 0301]] によって拡張された[[元号]]による[[日付]]の表現では、
[[ピリオド]] [SRC[>>27 5.1.3]] を用いています。これは [CODE[[[,]]]] ではなく、
[CODE[.][FULL STOP]] でなければなりません。
** 斜線
[64] [CODE[[[/]]]] は、[[time interval]] や [[recurring time interval]] の区切りに使います
[SRC[>>7 3.4.4, >>7 4.4.2 a)]]。
[98] [[応用分野]]によっては、 [CODE[[[/]]]] のかわりに[[二重ハイフン]]を使うことがあります
[SRC[>>7 4.4.2 NOTE]]。
;; [99] 「使うことがある」というのが、[[情報交換の当事者間の合意]]によって代用しても良いということなのか、
どういう意味なのか、はっきりしません。
* プロファイルと変種
[66] [[ISO 8601]] は[[日時表現]]や[[日時書式表現]]について、多くのバリエーションを定義していますし、
[[情報交換の当事者間の合意]]によって様々なオプションを採用できるとしています。
そのため様々な[DFN[ISO 8601のプロファイル]]が存在しています。
[68] [[情報交換の当事者間の合意]]によって何らかの表現を採用する場合、
他の表現が曖昧無く区別できるように注意する必要があります [SRC[>>7 3.7]]。
[151] 不思議なことに全体としての[[適合性]]の規定がありませんが、明らかに、
仕様上認められ得るすべての表現を生成したり、理解したりすることは求められておらず、
応用分野と当事者間の合意によって必要な範囲の構文に対応するべきであると解するのが妥当でしょう。
;; [152] 実際、[[情報交換の当事者間の合意]]によって認められる構文の採用の仕方によっては、
何を意味するか曖昧性が生じてしまうことがありますから、
無条件に任意の入力を受け付けるような実装は作れません。
[153] [[プログラミング言語]]、[[プロトコル]]その他各種の[[応用分野]]において、
[[ISO 8601]] の一部機能を選択したり、それを元に拡張したりしたものが存在します。
その粒度は様々で、自由度が高いものもあれば、一意に表現が定まるようなものもあります。
[154] [[ISO 8601]] を参照して定義されているものもあれば、完全に独自に互換な表現を定義しているものもあります。
[155] [[ISO 8601]] はそのような[[プロファイル]]の適合性を定義していませんから、
どれだけ制限や改変を加えても [[ISO 8601]] に適合していると主張できるのかははっきりしません。
[EG[
[156] 例えば [[RFC 3339の日付形式]]は [CODE[[[T]]]] や [CODE[[[Z]]]] を[[小文字]]でも良いとしていますが、
[[ISO 8601]] では >>52 の通り[[小文字]]による代用こそ認められていますが、
混在させると [[ISO 8601]] に適合しないかもしれません。
[157] [CODE[[[xs:dateTime]]]] では5桁以上の[[年]]を認めていますが、その前に [CODE[[[+]]]]
を書くことができませんから、[[完全表現]]でも[[展開表現]]でもありません。
[[ISO 8601]] に適合しない拡張ということになります。
[158] [CODE[[[xs:gYear]]]] は[[年]]と[[時差]]を組み合わせていますが、 [[ISO 8601]]
ではこのような組み合わせ方は定義されていません。
]EG]
[212] 困ったことに、 [[ISO 8601]] のうちの一部の機能のみを採用したものを
「[[ISO 8601]] 形式」のように呼ぶ人が少なくありません。
実際に [[ISO 8601]] のどの一部を採用するかはものにより異なっていますし、
そのようないい加減な文書はまともに説明していないので、
文脈や例示、実装状況などから何を表しているか推測するしかありません。
** 主要プロファイルの比較
[25] 主要なプロファイルの違いは次のようになっています。
[FIG(table)[
:x:
:年のみ :年のみ
:年月のみ :年月のみ
:年月日のみ :年月日のみ
:負の年 :負の年
:0年 :0年
:5桁以上の年 :5桁以上の年
:日時区切り :日時区切り
:24時 :24時
:秒の省略 :秒の省略
:秒の小数部 :秒の小数部
:[[閏秒]] :[[閏秒]]
:[[時間帯]] :[[時間帯]]
:[[UTC]] :[[UTC]]
:[[時間帯]]の[[時]]の範囲 :[[時間帯]]の[[時]]の範囲
:-0000 :[[-00:00]]
:x:[[HTMLの日時形式]]
:年のみ :○
:年月のみ :○
:年月日のみ :○
:負の年 :×
:0年 :×
:5桁以上の年 :○
:日時区切り :[CODE[T]] / [CODE[[[U+0020]]]]
:24時 :×
:秒の省略 :○
:秒の小数部 :指定可
:[[閏秒]] :なし
:[[時間帯]] :時刻ありなら指定可
:[[UTC]] :[CODE[Z]]
:[[時間帯]]の[[時]]の範囲 :0-23
:-0000 :禁止
:x:[[XML Schemaの日時形式]] (1.0)
:年のみ :○
:年月のみ :○
:年月日のみ :○
:負の年 :[[紀元前]]
:0年 :×
:5桁以上の年 :[[先導0]]禁止
:日時区切り :[CODE[T]]
:24時 :○
:秒の省略 :×
:秒の小数部 :指定可
:[[閏秒]] :なし
:[[時間帯]] :指定可
:[[UTC]] :[CODE[Z]]
:[[時間帯]]の[[時]]の範囲 :0-14
:-0000 :特記なし
:x:[[XML Schemaの日時形式]] (1.1)
:年のみ :○
:年月のみ :○
:年月日のみ :○
:負の年 :○
:0年 :○
:5桁以上の年 :[[先導0]]禁止
:日時区切り :[CODE[T]]
:24時 :○
:秒の省略 :×
:秒の小数部 :指定可
:[[閏秒]] :なし
:[[時間帯]] :指定可
:[[UTC]] :[CODE[Z]]
:[[時間帯]]の[[時]]の範囲 :0-14
:-0000 :特記なし
:x:[[RFC 3339の日付形式]]
:年のみ :×
:年月のみ :×
:年月日のみ :×
:負の年 :×
:0年 :○
:5桁以上の年 :×
:日時区切り :[CODE[T]] / [CODE[t]] / 任意
:24時 :×
:秒の省略 :×
:秒の小数部 :指定可
:[[閏秒]] :60まで
:[[時間帯]] :必須
:[[UTC]] :[CODE[Z]] / [CODE[z]]
:[[時間帯]]の[[時]]の範囲 :0-23
:-0000 :「不明」
:x:[[W3C-DTF]]
:年のみ :○
:年月のみ :○
:年月日のみ :○
:負の年 :×
:0年 :○
:5桁以上の年 :×
:日時区切り :[CODE[T]]
:24時 :×
:秒の省略 :○
:秒の小数部 :指定可
:[[閏秒]] :なし
:[[時間帯]] :時刻ありなら必須
:[[UTC]] :[CODE[Z]]
:[[時間帯]]の[[時]]の範囲 :記載なし
:-0000 :特記なし
]FIG]
;; 詳細はそれぞれの項を参照。
** プロファイルや変種の例
[9]
[[RFC 3339の日付形式]]は、特定の日時を表す[[部分集合]]で、
新しい [[IETF]] の技術ではこれを採用することが推奨されています。
[10] [[XML Schema]] の仕様書第2部ではいろいろな基本的な[[データ型]]を規定していますが、
その中には RFC 3339 の日付形式に極めてよく似たものを含め、
いくつかの日付や時刻や時間の表現のための形式が定義されています。
[23] [[HTMLの日付形式]]のいくつかは、 [[ISO 8601]] をもとに定義されています。
[24] [[JavaScriptの日付形式]]には、 [[ISO 8601の日付形式]]の[[プロファイル]]が含まれています。
[11]
[[W3C]] [[Member Submission]] [[Note]] である [CITE[Date and Time Formats]]
は、
[[RFC 3339の日付形式]]を同じものや、それよりも精度が低いもの
[WEAK[(時刻を省略したものなど)]] など数種類の形式
(通称 [[W3C-DTF]]) を提案しています。
[[HTML 4]] などが採用していますが、 XML Schema
データ型の登場により現在では時代遅れであると考えられています。
[4] [[RFC 2326の時刻形式]]の1つ、 [CODE(ABNF)[[[npt-range]]]] は、
ISO 8601 に従った書式で、演奏時間範囲を指定するのに使われます。
[5] [[PICSの日付形式]]は2種類あり、そのうちの新しい方は
ISO 8601 に基づく書式です。 XML Schema のデータ型のものと似ていますが、
微妙に異なります。
[14]
[CITE@en-us[XLIFF 1.1 Specification]] ([CODE[2006-07-08 02:30:08 +09:00]] 版) <http://www.oasis-open.org/committees/xliff/documents/cs-xliff-core-1.1-20031031.htm#date>
[22] [CITE[XLIFF 1.2 Specification]] ([TIME[2008-02-05 00:30:42 +09:00]] 版) <http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#date>
[15]
[CITE[Global Information Management eXchange Metrics Volume 1.0 Specification]] ([CODE[2007-02-24 17:44:10 +09:00]] 版) <http://www.lisa.org/standards/gmx/GMX-V.html#Attr_date>
>>14 の関連規格だけど日付形式は違う
([[名無しさん]])
[16]
[CITE@en-us[TMX Specification]] ([CODE[2007-02-24 17:51:20 +09:00]] 版) <http://www.lisa.org/standards/tmx/tmx.html#changedate>
([[名無しさん]])
[17]
[CITE@en-us[TMX Specification]] ([CODE[2007-02-24 17:51:20 +09:00]] 版) <http://www.lisa.org/standards/tmx/tmx.html#creationdate>
([[名無しさん]])
[18]
[CITE@en-us[TMX Specification]] ([CODE[2007-02-24 17:51:20 +09:00]] 版) <http://www.lisa.org/standards/tmx/tmx.html#lastusagedate>
([[名無しさん]])
[19]
[CITE[XML Text Memory Namespace 1.0 Specification]] ([CODE[2007-02-24 17:56:51 +09:00]] 版) <http://www.lisa.org/standards/xmltm/xml-tm.html#Attr_date>
([[名無しさん]])
[20]
[CITE@en[TermBase eXchange Link (TBX Link) Specification]] ([TIME[2007-02-24 18:05:26 +09:00]] 版) <http://www.lisa.org/standards/tbxlink/tbxlink.html#Attr_date>
- [[HTMLの時間形式]]
- [CODE(XML)@en[[[xs:duration]]]]
[12] [[PICSの日付形式]]は2種類あり、そのうちの古い方は
ISO 8601 に基づいた書式であることを意図していましたが、
日付の部分の区切子に誤って [CODE(char)[[[HYPHEN-MINUS]]]]
ではなく [CODE(char)[[[FULL STOP]]]] を使っていました。
(新しい方の書式では修正されています。)
[13] ISO 8601 の日本版規格である [[JIS X 0301]] (>>39) は、 ISO 8601
に加えて[[元号]]を使った[[和暦]]の[[年号]]を表現するための書式を規定しています。
[21] [[HTMLの日付形式]]は実質的に [[ISO 8601]] の[[プロファイル]]ですが、
[[ISO 8601]] を[[引用]]せずに定義されています。 [[HTML]] は[[閏秒]]に対応していないなどの違いもあります。
[186] [[OGPの日時形式]]も、 [[ISO 8601]] を基にしています。
[191] [[AWS]] は [[ISO 8601]] 形式と称して、 [CODE[[VAR[YYYY]][VAR[MM]][VAR[DD]]T[VAR[hh]][VAR[mm]][VAR[ss]]Z]]
のような記号を使わない形式を用いています [SRC[>>190]]。
[195] [[[CODE[clock]] (RTSP)]]
[196] [[NPT]]
[REFS[
- [190] [CITE[Signature Calculations for the Authorization Header: Transferring Payload in a Single Chunk (AWS Signature Version 4) - Amazon Simple Storage Service]] ([TIME[2017-02-11 04:52:51 +09:00]]) <http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html>
]REFS]
[187] [[XMPPの日時形式]]も、 [[ISO 8601]] から派生したものです。
*** RFC 3339 の ISO 8601 構文
[203] [[RFC 3339]] は、[[RFC 3339の日時形式]]を規定するだけでなく、
[[ISO 8601:1988]] の [[ABNF]] 構文も[[参考]]として示しています [SRC[>>202]]。
[204] [[RFC 3339]] は [[ISO 8601]] が曖昧であると指摘して、
次のように解釈しています [SRC[>>202]]。
- [205] [[基本書式]]と[[拡張書式]]の混合が認められるか不明なので、
認めることとする。
- [206] [[時]]が [N[24]] で[[分]]と[[秒]]が [N[0]] 以外となることが認められるか不明なので、
[[分]]と[[秒]]に関わらず認めることとする。
- [207] [[月]]の[[日の数]]の制約を適用する。
- [208] [CODE[T]] が省略できる場合があるとされているが、
曖昧性を除去するため、必須とする。
- [209] [[小数部]]があって[[整数部]]が [N[0]] のとき、 [CODE[0]]
を省略できないと本文にあり、省略した例示があるが、
本文に従い省略できないこととする。
[211] こうした問題のいくつかは、 [[ISO 8601]] の改訂で解消しています。
[REFS[
- [202] [CITE@en[RFC 3339 - Date and Time on the Internet: Timestamps]] ([TIME[2017-05-07 16:17:18 +09:00]]) <https://tools.ietf.org/html/rfc3339#appendix-A>
- [210] [CITE[RFC Errata Report » RFC Editor]] ([TIME[2017-05-17 21:31:41 +09:00]]) <https://www.rfc-editor.org/errata_search.php?rfc=3339>
]REFS]
** その他の応用
[FIG(short list)[ [241] [[ISO 8601]] の応用
- [[Date-and-Time][ISO/IEC 11404の日時形式]]
- [[Time][SensorMLの日時形式]]
- [[GMLの日時形式]]
- [CODE[iso-8601-date]]
- [[Coverage Element]]
- [[ODETTEの日時形式]]
- [CODE[:server-time]]
- [[XFAの日時形式]]
- [[P3Pの日時形式]]
- [CODE[tag:]]
]FIG]
[243] [DFN[ISO 19103の日時形式]]は、
[DFN[[CODE[Date][ISO 19103 Date]]]],
[DFN[[CODE[Time][ISO 19103 Time]]]],
[DFN[[CODE[DateTime][ISO 19103 DateTime]]]]
など [[ISO 8601の日時形式]]を採用した[[データ型]]です。
[[ISO 19108]] など [[ISO 19100シリーズ]]で使われています。
[269]
[[DSSSL]]
の
[[JIS X 4153:1998]] 8.5.11
は、
「ISO 8601形式の日付又は時刻」
を扱っていました。
[270]
[[ISO 12083]]:
[[JIS X 0804-1996]] p.115
[CODE[DATE]]
[[要素]]では、
[L[[B[ISO 8601]]:1988の方式]], [L[mm-dd-yy]], [L[mm/dd/yy]], [L[dd-mm-yy]], [L[月日年]]
のいずれかの形式を使えるものとし、
他の形式にも拡張できるとしていました。
[271]
[[DC]] の [[Date][dc:date]]
は
[[ISO 8601]]
のプロファイルを[[推奨]]していました。
[[JIS]] 版は
[[JIS X 0301]]
のプロファイルを[[推奨]]していました。
その具象構文の一種である
[[RSS 1.0]]
の
[CODE[dc:date]]
は、
[[W3C-DTF]] とすることを求めていました。
[SEE[ [CODE[dc:date]] ]]
[310] [CITE@en[RFC 767 - Structured format for transmission of multi-media documents]], [TIME[2021-02-14T20:19:32.000Z]], [TIME[2021-03-10T06:31:38.981Z]] <https://tools.ietf.org/html/rfc767#page-7>
[313]
[DFN[STONの日時形式]]
[FIG(quote)[
[FIGCAPTION[
[314]
[CITE@en[ston/ston-paper.md at master · svenvc/ston · GitHub]], [TIME[2021-09-26T01:37:11.000Z]] <https://github.com/svenvc/ston/blob/master/ston-paper.md#conventional-representations>
]FIGCAPTION]
>
-[B[Time]] a one element array with an ISO style HH:MM:SS string
-[B[Date]] a one element array with an ISO style YYYYMMDD string
-[B[DateAndTime]], [B[TimeStamp]] a one element array with an ISO style YYYY-MM-DDTHH:MM:SS.N+TZ.TZ string
]FIG]
[317]
「ISO style」が何を意味するか明らかではありませんが、
[[ISO 8601]]
のことだとすると、 [CODE[+TZ.TZ]] は構文が微妙に違っています。
[FIG(quote)[
[FIGCAPTION[
[315]
[CITE@en[ston/ston-spec.md at master · svenvc/ston · GitHub]], [TIME[2021-09-26T01:40:55.000Z]] <https://github.com/svenvc/ston/blob/master/ston-spec.md#time>
]FIGCAPTION]
>
[B[Time]]
>
Simple time data is represented using a singleton list with a string in ISO style "HH:MM:SS.N" representation (with optional nanoseconds).
[PRE[
Time [ '20:28:41' ]
Time [ '20:28:41.063687' ]
]PRE]
>
[B[Date]]
>
The date object is represented using a singleton list with a string in ISO style "YYYY-MM-DD[+|-]hh:mm" representation (with timezone offset).
[PRE[
Date [ '2018-10-29+01:00' ]
]PRE]
>
[B[DateAndTime]]
>
The timestamp (date and time) object is represented using a singleton list with a string in ISO style "YYYY-MM-DDTHH:MM:SS.N[+|-]" representation (with timezone offset and optional nanoseconds).
[PRE[
DateAndTime [ '2018-10-29T20:30:35+00:00' ]
DateAndTime [ '2018-10-29T20:30:35.899433+01:00' ]
]PRE]
]FIG]
[316]
こちらの 「ISO style」 は [[ISO 8601]] の形式。
* 各国版
[234] 他の [[ISO]] の[[国際標準]]と同じように、
各国の[[国内規格]]ともなっています。
** 米国