-
Notifications
You must be signed in to change notification settings - Fork 4
/
208.txt
161 lines (114 loc) · 8.27 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
[6] [[ISO 8601]] は[[日付]]や[[時刻]]や[[時間]]を[[文字列]]によって表現する方法に関する
[[ISO]] [[国際標準]]です。
[[ISO 8601]] で規定された日付・時刻の表現方法は、
色々な部分を必要に応じて組み合わせる形になっているので、
貪欲に全部実装しようとすると[WEAK[(解析が)]]ちょっと面倒
[WEAK[(あるいは不可能)]] です。
そのため、場面に応じて必要な要素を組み合わせた[DFN[プロファイル]]が定義されています。
* 仕様書
[REFS[
- [7] '''[[ISO 8601]]'''
- [27] [[JIS X 0301]]: ISO 8601 に対応 ([[MOD]]) する [[JIS]]
]REFS]
* 書式
[36] [[ISO 8601の日付形式]]には様々なバリエーション (自由度) があり、
次のような用語が定義されています。
[26] [DFN[[RUBYB[[[日時表現]]]@en[date and time representation]]]]は、
[[時間点]]や[[time interval]]、[[recurring time interval]] を示す表現です [SRC[>>7 2.3.1]]。
[28] [DFN[[RUBYB[[[日時書式表現]]]@en[date and time format representation]]]]は、
[[日時表現]]の群の書式を説明する表現です [SRC[>>7 2.3.2]]。
[29] [DFN[[RUBYB[[[基本書式]]]@en[basic format]]]]は、
要求される精度に必要なだけの最小の時刻要素により構成される[[日時表現]]または[[日時書式表現]]の書式です
[SRC[>>7 2.3.3]]。
;; [30] [[基本書式]]は、[[平文]]では避けるべきです [SRC[>>7 2.3.3 NOTE]]。
[31] [DFN[[RUBYB[[[拡張書式]]]@en[extended format]]]]は、
[[基本書式]]に追加の[[分離子]]を含めて拡張したものです [SRC[>>7 2.3.4]]。
[32] [DFN[[RUBYB[[[完全表現]]]@en[complete representation]]]]は、
書式に関連付けられている日時部品すべてを含む表現です。
[[暦年]]を表す表現の時刻要素は4桁に限られます。 [SRC[>>7 2.3.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]]
* プロファイル
[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]]
<http://www.w3.org/TR/1998/NOTE-datetime> は、
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>
[[#comment]]
* 変種
[12] [[PICSの日付形式]]は2種類あり、そのうちの古い方は
ISO 8601 に基づいた書式であることを意図していましたが、
日付の部分の区切子に誤って [CODE(char)[[[HYPHEN-MINUS]]]]
ではなく [CODE(char)[[[FULL STOP]]]] を使っていました。
(新しい方の書式では修正されています。)
[13] ISO 8601 の日本版規格である [[JIS X 0301]] は、 ISO 8601
に加えて[[元号]]を使った[[和暦]]の[[年号]]を表現するための書式を規定しています。
[21] [[HTMLの日付形式]]は実質的に [[ISO 8601]] の[[プロファイル]]ですが、
[[ISO 8601]] を[[引用]]せずに定義されています。 [[HTML]] は[[閏秒]]に対応していないなどの違いもあります。
* 主要プロファイルの比較
[25] 主要なプロファイルの違いは次のようになっています。
, ,[[HTML]]: [[妥当な大域日時文字列]],[[HTML]]: [[妥当な地方日時文字列]] ,[CODE[[[xs:dateTime]]]] (1.1),[CODE[[[xs:dateTimeStamp]]]] (1.1) ,[[RFC 3339の日付形式]] ,[[W3C-DTF]]
,年のみ ,×,× ,×,× ,× ,○
,年月のみ ,×,× ,×,× ,× ,○
,年月日のみ ,×,× ,×,× ,× ,○
,負の年 ,×,× ,○,○ ,× ,×
,0年 ,×,× ,○,○ ,○ ,○
,5桁以上の年 ,○,○ ,[[先導0]]禁止,[[先導0]]禁止 ,× ,×
,日時区切り ,[CODE[T]]/[CODE[[[U+0020]]]],[CODE[T]]/[CODE[[[U+0020]]]] ,[CODE[T]],[CODE[T]] ,[CODE[T]]/[CODE[t]], [CODE[T]]
,24時 ,×,× ,○,○ ,× ,×
,秒の省略 ,○,○ ,×,× ,× ,○
,秒の小数部 ,指定可,指定可 ,指定可,指定可 ,指定可 ,指定可
,[[閏秒]] ,なし,なし ,なし,なし ,60まで ,なし
,[[時間帯]] ,必須,禁止 ,指定可,必須 ,必須 ,時刻ありなら必須
,[[UTC]] ,[CODE[Z]],- ,[CODE[Z]],[CODE[Z]] ,[CODE[Z]]/[CODE[z]] ,[CODE[Z]]
,[[時間帯]]の[[時]]の範囲 ,0-23,- ,0-14,0-14 ,0-23 ,記載なし
,[[-00:00]] ,禁止,- ,特記なし,特記なし ,「不明」の意 ,特記なし
* メモ
[1] ''日付および時刻の国際標準表記法''
<http://www.geocities.co.jp/CollegeLife-Cafe/1646/roomazi/date-time.html>:
例の[[まーくん]]の、 ISO 8601 推進のための入門的紹介文の翻訳。
[2] >>1 まあさすがに原文がまーくんだけあって中々まーくん風味のまーくん的文章ですね(謎)
[3] >>1−2 なんだかんだ言ってまーくんって英語圏では有名人で影響力ある人だし、
実際 >>1 の原文も英語の技術系 ML とか Web とかでよく参照されてるよねぇ。