Debian Codegraph @

rfc3339.html

raw
1 <pre>Network Working Group G. Klyne
2 Request for Comments: 3339 Clearswift Corporation
3 Category: Standards Track C. Newman
4 Sun Microsystems
5 July 2002
6
7
8 <span class="h1">Date and Time on the Internet: Timestamps</span>
9
10 Status of this Memo
11
12 This document specifies an Internet standards track protocol for the
13 Internet community, and requests discussion and suggestions for
14 improvements. Please refer to the current edition of the "Internet
15 Official Protocol Standards" (STD 1) for the standardization state
16 and status of this protocol. Distribution of this memo is unlimited.
17
18 Copyright Notice
19
20 Copyright (C) The Internet Society (2002). All Rights Reserved.
21
22 Abstract
23
24 This document defines a date and time format for use in Internet
25 protocols that is a profile of the ISO 8601 standard for
26 representation of dates and times using the Gregorian calendar.
27
28 Table of Contents
29
30 <a href="#section-1">1</a>. Introduction ............................................ <a href="#page-2">2</a>
31 <a href="#section-2">2</a>. Definitions ............................................. <a href="#page-3">3</a>
32 <a href="#section-3">3</a>. Two Digit Years ......................................... <a href="#page-4">4</a>
33 <a href="#section-4">4</a>. Local Time .............................................. <a href="#page-4">4</a>
34 <a href="#section-4.1">4.1</a>. Coordinated Universal Time (UTC) ...................... <a href="#page-4">4</a>
35 <a href="#section-4.2">4.2</a>. Local Offsets ......................................... <a href="#page-5">5</a>
36 <a href="#section-4.3">4.3</a>. Unknown Local Offset Convention ....................... <a href="#page-5">5</a>
37 <a href="#section-4.4">4.4</a>. Unqualified Local Time ................................ <a href="#page-5">5</a>
38 <a href="#section-5">5</a>. Date and Time format .................................... <a href="#page-6">6</a>
39 <a href="#section-5.1">5.1</a>. Ordering .............................................. <a href="#page-6">6</a>
40 <a href="#section-5.2">5.2</a>. Human Readability ..................................... <a href="#page-6">6</a>
41 <a href="#section-5.3">5.3</a>. Rarely Used Options ................................... <a href="#page-7">7</a>
42 <a href="#section-5.4">5.4</a>. Redundant Information ................................. <a href="#page-7">7</a>
43 <a href="#section-5.5">5.5</a>. Simplicity ............................................ <a href="#page-7">7</a>
44 <a href="#section-5.6">5.6</a>. Internet Date/Time Format ............................. <a href="#page-8">8</a>
45 <a href="#section-5.7">5.7</a>. Restrictions .......................................... <a href="#page-9">9</a>
46 <a href="#section-5.8">5.8</a>. Examples ............................................. <a href="#page-10">10</a>
47 <a href="#section-6">6</a>. References ............................................. <a href="#page-10">10</a>
48 <a href="#section-7">7</a>. Security Considerations ................................ <a href="#page-11">11</a>
49
50
51
52 <span class="grey">Klyne, et. al. Standards Track [Page 1]</span></pre>
53 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
54 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
55
56
57 <a href="#appendix-A">Appendix A</a>. ISO 8601 Collected ABNF ....................... <a href="#page-12">12</a>
58 <a href="#appendix-B">Appendix B</a>. Day of the Week ............................... <a href="#page-14">14</a>
59 <a href="#appendix-C">Appendix C</a>. Leap Years .................................... <a href="#page-14">14</a>
60 <a href="#appendix-D">Appendix D</a>. Leap Seconds ..............................,... <a href="#page-15">15</a>
61 Acknowledgements .......................................... <a href="#page-17">17</a>
62 Authors' Addresses ........................................ <a href="#page-17">17</a>
63 Full Copyright Statement .................................. <a href="#page-18">18</a>
64
65 <span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
66
67 Date and time formats cause a lot of confusion and interoperability
68 problems on the Internet. This document addresses many of the
69 problems encountered and makes recommendations to improve consistency
70 and interoperability when representing and using date and time in
71 Internet protocols.
72
73 This document includes an Internet profile of the ISO 8601 [<a href="#ref-ISO8601" title="&quot;Data elements and interchange formats -- Information interchange -- Representation of dates and times&quot;">ISO8601</a>]
74 standard for representation of dates and times using the Gregorian
75 calendar.
76
77 There are many ways in which date and time values might appear in
78 Internet protocols: this document focuses on just one common usage,
79 viz. timestamps for Internet protocol events. This limited
80 consideration has the following consequences:
81
82 o All dates and times are assumed to be in the "current era",
83 somewhere between 0000AD and 9999AD.
84
85 o All times expressed have a stated relationship (offset) to
86 Coordinated Universal Time (UTC). (This is distinct from some
87 usage in scheduling applications where a local time and location
88 may be known, but the actual relationship to UTC may be dependent
89 on the unknown or unknowable actions of politicians or
90 administrators. The UTC time corresponding to 17:00 on 23rd March
91 2005 in New York may depend on administrative decisions about
92 daylight savings time. This specification steers well clear of
93 such considerations.)
94
95 o Timestamps can express times that occurred before the introduction
96 of UTC. Such timestamps are expressed relative to universal time,
97 using the best available practice at the stated time.
98
99 o Date and time expressions indicate an instant in time.
100 Description of time periods, or intervals, is not covered here.
101
102
103
104
105
106
107
108 <span class="grey">Klyne, et. al. Standards Track [Page 2]</span></pre>
109 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
110 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
111
112
113 <span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Definitions</span>
114
115 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
116 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
117 document are to be interpreted as described in <a href="./rfc2119">RFC 2119</a> [<a href="./rfc2119" title="&quot;Key words for use in RFCs to Indicate Requirement Levels&quot;">RFC2119</a>].
118
119 UTC Coordinated Universal Time as maintained by the Bureau
120 International des Poids et Mesures (BIPM).
121
122 second A basic unit of measurement of time in the
123 International System of Units. It is defined as the
124 duration of 9,192,631,770 cycles of microwave light
125 absorbed or emitted by the hyperfine transition of
126 cesium-133 atoms in their ground state undisturbed by
127 external fields.
128
129 minute A period of time of 60 seconds. However, see also the
130 restrictions in <a href="#section-5.7">section 5.7</a> and <a href="#appendix-D">Appendix D</a> for how
131 leap seconds are denoted within minutes.
132
133 hour A period of time of 60 minutes.
134
135 day A period of time of 24 hours.
136
137 leap year In the Gregorian calendar, a year which has 366 days.
138 A leap year is a year whose number is divisible by
139 four an integral number of times, except that if it is
140 a centennial year (i.e. divisible by one hundred) it
141 shall also be divisible by four hundred an integral
142 number of times.
143
144 ABNF Augmented Backus-Naur Form, a format used to represent
145 permissible strings in a protocol or language, as
146 defined in [<a href="#ref-ABNF" title="&quot;Augmented BNF for Syntax Specifications: ABNF&quot;">ABNF</a>].
147
148 Email Date/Time Format
149 The date/time format used by Internet Mail as defined
150 by <a href="./rfc2822">RFC 2822</a> [<a href="#ref-IMAIL-UPDATE" title="&quot;Internet Message Format&quot;">IMAIL-UPDATE</a>].
151
152 Internet Date/Time Format
153 The date format defined in <a href="#section-5">section 5</a> of this document.
154
155 Timestamp This term is used in this document to refer to an
156 unambiguous representation of some instant in time.
157
158 Z A suffix which, when applied to a time, denotes a UTC
159 offset of 00:00; often spoken "Zulu" from the ICAO
160 phonetic alphabet representation of the letter "Z".
161
162
163
164 <span class="grey">Klyne, et. al. Standards Track [Page 3]</span></pre>
165 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
166 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
167
168
169 For more information about time scales, see <a href="#appendix-E">Appendix E</a> of [<a href="#ref-NTP" title="&quot;Network Time Protocol (Version 3) Specification, Implementation and Analysis&quot;">NTP</a>],
170 Section 3 of [<a href="#ref-ISO8601" title="&quot;Data elements and interchange formats -- Information interchange -- Representation of dates and times&quot;">ISO8601</a>], and the appropriate ITU documents [ITU-R-
171 TF].
172
173 <span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Two Digit Years</span>
174
175 The following requirements are to address the problems of ambiguity
176 of 2-digit years:
177
178 o Internet Protocols MUST generate four digit years in dates.
179
180 o The use of 2-digit years is deprecated. If a 2-digit year is
181 received, it should be accepted ONLY if an incorrect
182 interpretation will not cause a protocol or processing failure
183 (e.g. if used only for logging or tracing purposes).
184
185 o It is possible that a program using two digit years will
186 represent years after 1999 as three digits. This occurs if the
187 program simply subtracts 1900 from the year and doesn't check
188 the number of digits. Programs wishing to robustly deal with
189 dates generated by such broken software may add 1900 to three
190 digit years.
191
192 o It is possible that a program using two digit years will
193 represent years after 1999 as ":0", ":1", ... ":9", ";0", ...
194 This occurs if the program simply subtracts 1900 from the year
195 and adds the decade to the US-ASCII character zero. Programs
196 wishing to robustly deal with dates generated by such broken
197 software should detect non-numeric decades and interpret
198 appropriately.
199
200 The problems with two digit years amply demonstrate why all dates and
201 times used in Internet protocols MUST be fully qualified.
202
203 <span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Local Time</span>
204
205 <span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>. Coordinated Universal Time (UTC)</span>
206
207 Because the daylight saving rules for local time zones are so
208 convoluted and can change based on local law at unpredictable times,
209 true interoperability is best achieved by using Coordinated Universal
210 Time (UTC). This specification does not cater to local time zone
211 rules.
212
213
214
215
216
217
218
219
220 <span class="grey">Klyne, et. al. Standards Track [Page 4]</span></pre>
221 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
222 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
223
224
225 <span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>. Local Offsets</span>
226
227 The offset between local time and UTC is often useful information.
228 For example, in electronic mail (<a href="./rfc2822">RFC2822</a>, [<a href="#ref-IMAIL-UPDATE" title="&quot;Internet Message Format&quot;">IMAIL-UPDATE</a>]) the local
229 offset provides a useful heuristic to determine the probability of a
230 prompt response. Attempts to label local offsets with alphabetic
231 strings have resulted in poor interoperability in the past [<a href="#ref-IMAIL" title="&quot;Standard for the Format of Arpa Internet Text Messages&quot;">IMAIL</a>],
232 [<a href="#ref-HOST-REQ" title="&quot;Requirements for Internet Hosts -- Application and Support&quot;">HOST-REQ</a>]. As a result, <a href="./rfc2822">RFC2822</a> [<a href="#ref-IMAIL-UPDATE" title="&quot;Internet Message Format&quot;">IMAIL-UPDATE</a>] has made numeric
233 offsets mandatory.
234
235 Numeric offsets are calculated as "local time minus UTC". So the
236 equivalent time in UTC can be determined by subtracting the offset
237 from the local time. For example, 18:50:00-04:00 is the same time as
238 22:50:00Z. (This example shows negative offsets handled by adding
239 the absolute value of the offset.)
240
241 NOTE: Following ISO 8601, numeric offsets represent only time
242 zones that differ from UTC by an integral number of minutes.
243 However, many historical time zones differ from UTC by a non-
244 integral number of minutes. To represent such historical time
245 stamps exactly, applications must convert them to a representable
246 time zone.
247
248 <span class="h3"><a class="selflink" id="section-4.3" href="#section-4.3">4.3</a>. Unknown Local Offset Convention</span>
249
250 If the time in UTC is known, but the offset to local time is unknown,
251 this can be represented with an offset of "-00:00". This differs
252 semantically from an offset of "Z" or "+00:00", which imply that UTC
253 is the preferred reference point for the specified time. <a href="./rfc2822">RFC2822</a>
254 [<a href="#ref-IMAIL-UPDATE" title="&quot;Internet Message Format&quot;">IMAIL-UPDATE</a>] describes a similar convention for email.
255
256 <span class="h3"><a class="selflink" id="section-4.4" href="#section-4.4">4.4</a>. Unqualified Local Time</span>
257
258 A number of devices currently connected to the Internet run their
259 internal clocks in local time and are unaware of UTC. While the
260 Internet does have a tradition of accepting reality when creating
261 specifications, this should not be done at the expense of
262 interoperability. Since interpretation of an unqualified local time
263 zone will fail in approximately 23/24 of the globe, the
264 interoperability problems of unqualified local time are deemed
265 unacceptable for the Internet. Systems that are configured with a
266 local time, are unaware of the corresponding UTC offset, and depend
267 on time synchronization with other Internet systems, MUST use a
268 mechanism that ensures correct synchronization with UTC. Some
269 suitable mechanisms are:
270
271 o Use Network Time Protocol [<a href="#ref-NTP" title="&quot;Network Time Protocol (Version 3) Specification, Implementation and Analysis&quot;">NTP</a>] to obtain the time in UTC.
272
273
274
275
276 <span class="grey">Klyne, et. al. Standards Track [Page 5]</span></pre>
277 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
278 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
279
280
281 o Use another host in the same local time zone as a gateway to the
282 Internet. This host MUST correct unqualified local times that are
283 transmitted to other hosts.
284
285 o Prompt the user for the local time zone and daylight saving rule
286 settings.
287
288 <span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Date and Time format</span>
289
290 This section discusses desirable qualities of date and time formats
291 and defines a profile of ISO 8601 for use in Internet protocols.
292
293 <span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Ordering</span>
294
295 If date and time components are ordered from least precise to most
296 precise, then a useful property is achieved. Assuming that the time
297 zones of the dates and times are the same (e.g., all in UTC),
298 expressed using the same string (e.g., all "Z" or all "+00:00"), and
299 all times have the same number of fractional second digits, then the
300 date and time strings may be sorted as strings (e.g., using the
301 strcmp() function in C) and a time-ordered sequence will result. The
302 presence of optional punctuation would violate this characteristic.
303
304 <span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. Human Readability</span>
305
306 Human readability has proved to be a valuable feature of Internet
307 protocols. Human readable protocols greatly reduce the costs of
308 debugging since telnet often suffices as a test client and network
309 analyzers need not be modified with knowledge of the protocol. On
310 the other hand, human readability sometimes results in
311 interoperability problems. For example, the date format "10/11/1996"
312 is completely unsuitable for global interchange because it is
313 interpreted differently in different countries. In addition, the
314 date format in [<a href="#ref-IMAIL" title="&quot;Standard for the Format of Arpa Internet Text Messages&quot;">IMAIL</a>] has resulted in interoperability problems when
315 people assumed any text string was permitted and translated the three
316 letter abbreviations to other languages or substituted date formats
317 which were easier to generate (e.g. the format used by the C function
318 ctime). For this reason, a balance must be struck between human
319 readability and interoperability.
320
321 Because no date and time format is readable according to the
322 conventions of all countries, Internet clients SHOULD be prepared to
323 transform dates into a display format suitable for the locality.
324 This may include translating UTC to local time.
325
326
327
328
329
330
331
332 <span class="grey">Klyne, et. al. Standards Track [Page 6]</span></pre>
333 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
334 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
335
336
337 <span class="h3"><a class="selflink" id="section-5.3" href="#section-5.3">5.3</a>. Rarely Used Options</span>
338
339 A format which includes rarely used options is likely to cause
340 interoperability problems. This is because rarely used options are
341 less likely to be used in alpha or beta testing, so bugs in parsing
342 are less likely to be discovered. Rarely used options should be made
343 mandatory or omitted for the sake of interoperability whenever
344 possible.
345
346 The format defined below includes only one rarely used option:
347 fractions of a second. It is expected that this will be used only by
348 applications which require strict ordering of date/time stamps or
349 which have an unusual precision requirement.
350
351 <span class="h3"><a class="selflink" id="section-5.4" href="#section-5.4">5.4</a>. Redundant Information</span>
352
353 If a date/time format includes redundant information, that introduces
354 the possibility that the redundant information will not correlate.
355 For example, including the day of the week in a date/time format
356 introduces the possibility that the day of week is incorrect but the
357 date is correct, or vice versa. Since it is not difficult to compute
358 the day of week from a date (see <a href="#appendix-B">Appendix B</a>), the day of week should
359 not be included in a date/time format.
360
361 <span class="h3"><a class="selflink" id="section-5.5" href="#section-5.5">5.5</a>. Simplicity</span>
362
363 The complete set of date and time formats specified in ISO 8601
364 [<a href="#ref-ISO8601" title="&quot;Data elements and interchange formats -- Information interchange -- Representation of dates and times&quot;">ISO8601</a>] is quite complex in an attempt to provide multiple
365 representations and partial representations. <a href="#appendix-A">Appendix A</a> contains an
366 attempt to translate the complete syntax of ISO 8601 into ABNF.
367 Internet protocols have somewhat different requirements and
368 simplicity has proved to be an important characteristic. In
369 addition, Internet protocols usually need complete specification of
370 data in order to achieve true interoperability. Therefore, the
371 complete grammar for ISO 8601 is deemed too complex for most Internet
372 protocols.
373
374 The following section defines a profile of ISO 8601 for use on the
375 Internet. It is a conformant subset of the ISO 8601 extended format.
376 Simplicity is achieved by making most fields and punctuation
377 mandatory.
378
379
380
381
382
383
384
385
386
387
388 <span class="grey">Klyne, et. al. Standards Track [Page 7]</span></pre>
389 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
390 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
391
392
393 <span class="h3"><a class="selflink" id="section-5.6" href="#section-5.6">5.6</a>. Internet Date/Time Format</span>
394
395 The following profile of ISO 8601 [<a href="#ref-ISO8601" title="&quot;Data elements and interchange formats -- Information interchange -- Representation of dates and times&quot;">ISO8601</a>] dates SHOULD be used in
396 new protocols on the Internet. This is specified using the syntax
397 description notation defined in [<a href="#ref-ABNF" title="&quot;Augmented BNF for Syntax Specifications: ABNF&quot;">ABNF</a>].
398
399 date-fullyear = 4DIGIT
400 date-month = 2DIGIT ; 01-12
401 date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
402 ; month/year
403 time-hour = 2DIGIT ; 00-23
404 time-minute = 2DIGIT ; 00-59
405 time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second
406 ; rules
407 time-secfrac = "." 1*DIGIT
408 time-numoffset = ("+" / "-") time-hour ":" time-minute
409 time-offset = "Z" / time-numoffset
410
411 partial-time = time-hour ":" time-minute ":" time-second
412 [time-secfrac]
413 full-date = date-fullyear "-" date-month "-" date-mday
414 full-time = partial-time time-offset
415
416 date-time = full-date "T" full-time
417
418 NOTE: Per [<a href="#ref-ABNF" title="&quot;Augmented BNF for Syntax Specifications: ABNF&quot;">ABNF</a>] and ISO8601, the "T" and "Z" characters in this
419 syntax may alternatively be lower case "t" or "z" respectively.
420
421 This date/time format may be used in some environments or contexts
422 that distinguish between the upper- and lower-case letters 'A'-'Z'
423 and 'a'-'z' (e.g. XML). Specifications that use this format in
424 such environments MAY further limit the date/time syntax so that
425 the letters 'T' and 'Z' used in the date/time syntax must always
426 be upper case. Applications that generate this format SHOULD use
427 upper case letters.
428
429 NOTE: ISO 8601 defines date and time separated by "T".
430 Applications using this syntax may choose, for the sake of
431 readability, to specify a full-date and full-time separated by
432 (say) a space character.
433
434
435
436
437
438
439
440
441
442
443
444 <span class="grey">Klyne, et. al. Standards Track [Page 8]</span></pre>
445 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
446 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
447
448
449 <span class="h3"><a class="selflink" id="section-5.7" href="#section-5.7">5.7</a>. Restrictions</span>
450
451 The grammar element date-mday represents the day number within the
452 current month. The maximum value varies based on the month and year
453 as follows:
454
455 Month Number Month/Year Maximum value of date-mday
456 ------------ ---------- --------------------------
457 01 January 31
458 02 February, normal 28
459 02 February, leap year 29
460 03 March 31
461 04 April 30
462 05 May 31
463 06 June 30
464 07 July 31
465 08 August 31
466 09 September 30
467 10 October 31
468 11 November 30
469 12 December 31
470
471 <a href="#appendix-C">Appendix C</a> contains sample C code to determine if a year is a leap
472 year.
473
474 The grammar element time-second may have the value "60" at the end of
475 months in which a leap second occurs -- to date: June (XXXX-06-
476 30T23:59:60Z) or December (XXXX-12-31T23:59:60Z); see <a href="#appendix-D">Appendix D</a> for
477 a table of leap seconds. It is also possible for a leap second to be
478 subtracted, at which times the maximum value of time-second is "58".
479 At all other times the maximum value of time-second is "59".
480 Further, in time zones other than "Z", the leap second point is
481 shifted by the zone offset (so it happens at the same instant around
482 the globe).
483
484 Leap seconds cannot be predicted far into the future. The
485 International Earth Rotation Service publishes bulletins [<a href="#ref-IERS">IERS</a>] that
486 announce leap seconds with a few weeks' warning. Applications should
487 not generate timestamps involving inserted leap seconds until after
488 the leap seconds are announced.
489
490 Although ISO 8601 permits the hour to be "24", this profile of ISO
491 8601 only allows values between "00" and "23" for the hour in order
492 to reduce confusion.
493
494
495
496
497
498
499
500 <span class="grey">Klyne, et. al. Standards Track [Page 9]</span></pre>
501 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
502 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
503
504
505 <span class="h3"><a class="selflink" id="section-5.8" href="#section-5.8">5.8</a>. Examples</span>
506
507 Here are some examples of Internet date/time format.
508
509 1985-04-12T23:20:50.52Z
510
511 This represents 20 minutes and 50.52 seconds after the 23rd hour of
512 April 12th, 1985 in UTC.
513
514 1996-12-19T16:39:57-08:00
515
516 This represents 39 minutes and 57 seconds after the 16th hour of
517 December 19th, 1996 with an offset of -08:00 from UTC (Pacific
518 Standard Time). Note that this is equivalent to 1996-12-20T00:39:57Z
519 in UTC.
520
521 1990-12-31T23:59:60Z
522
523 This represents the leap second inserted at the end of 1990.
524
525 1990-12-31T15:59:60-08:00
526
527 This represents the same leap second in Pacific Standard Time, 8
528 hours behind UTC.
529
530 1937-01-01T12:00:27.87+00:20
531
532 This represents the same instant of time as noon, January 1, 1937,
533 Netherlands time. Standard time in the Netherlands was exactly 19
534 minutes and 32.13 seconds ahead of UTC by law from 1909-05-01 through
535 1937-06-30. This time zone cannot be represented exactly using the
536 HH:MM format, and this timestamp uses the closest representable UTC
537 offset.
538
539 <span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. References</span>
540
541 [<a id="ref-ZELLER">ZELLER</a>] Zeller, C., "Kalender-Formeln", Acta Mathematica, Vol.
542 9, Nov 1886.
543
544 [<a id="ref-IMAIL">IMAIL</a>] Crocker, D., "Standard for the Format of Arpa Internet
545 Text Messages", STD 11, <a href="./rfc822">RFC 822</a>, August 1982.
546
547 [<a id="ref-IMAIL-UPDATE">IMAIL-UPDATE</a>] Resnick, P., "Internet Message Format", <a href="./rfc2822">RFC 2822</a>,
548 April 2001.
549
550 [<a id="ref-ABNF">ABNF</a>] Crocker, D. and P. Overell, "Augmented BNF for Syntax
551 Specifications: ABNF", <a href="./rfc2234">RFC 2234</a>, November 1997.
552
553
554
555
556 <span class="grey">Klyne, et. al. Standards Track [Page 10]</span></pre>
557 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
558 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
559
560
561 [<a id="ref-ISO8601">ISO8601</a>] "Data elements and interchange formats -- Information
562 interchange -- Representation of dates and times", ISO
563 8601:1988(E), International Organization for
564 Standardization, June, 1988.
565
566 [ISO8601:2000] "Data elements and interchange formats -- Information
567 interchange -- Representation of dates and times", ISO
568 8601:2000, International Organization for
569 Standardization, December, 2000.
570
571 [<a id="ref-HOST-REQ">HOST-REQ</a>] Braden, R., "Requirements for Internet Hosts --
572 Application and Support", STD 3, <a href="./rfc1123">RFC 1123</a>, October
573 1989.
574
575 [<a id="ref-IERS">IERS</a>] International Earth Rotation Service Bulletins,
576 &lt;<a href="http://hpiers.obspm.fr/eop-pc/products/bulletins.html">http://hpiers.obspm.fr/eop-</a>
577 <a href="http://hpiers.obspm.fr/eop-pc/products/bulletins.html">pc/products/bulletins.html</a>&gt;.
578
579 [<a id="ref-NTP">NTP</a>] Mills, D, "Network Time Protocol (Version 3)
580 Specification, Implementation and Analysis", <a href="./rfc1305">RFC 1305</a>,
581 March 1992.
582
583 [<a id="ref-ITU-R-TF">ITU-R-TF</a>] International Telecommunication Union Recommendations
584 for Time Signals and Frequency Standards Emissions.
585 &lt;<a href="http://www.itu.ch/publications/itu-r/iturtf.htm">http://www.itu.ch/publications/itu-r/iturtf.htm</a>&gt;
586
587 [<a id="ref-RFC2119">RFC2119</a>] Bradner, S, "Key words for use in RFCs to Indicate
588 Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.
589
590 <span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Security Considerations</span>
591
592 Since the local time zone of a site may be useful for determining a
593 time when systems are less likely to be monitored and might be more
594 susceptible to a security probe, some sites may wish to emit times in
595 UTC only. Others might consider this to be loss of useful
596 functionality at the hands of paranoia.
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612 <span class="grey">Klyne, et. al. Standards Track [Page 11]</span></pre>
613 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
614 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
615
616
617 <span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. ISO 8601 Collected ABNF</span>
618
619 This information is based on the 1988 version of ISO 8601. There may
620 be some changes in the 2000 revision.
621
622 ISO 8601 does not specify a formal grammar for the date and time
623 formats it defines. The following is an attempt to create a formal
624 grammar from ISO 8601. This is informational only and may contain
625 errors. ISO 8601 remains the authoritative reference.
626
627 Note that due to ambiguities in ISO 8601, some interpretations had to
628 be made. First, ISO 8601 is not clear if mixtures of basic and
629 extended format are permissible. This grammar permits mixtures. ISO
630 8601 is not clear on whether an hour of 24 is permissible only if
631 minutes and seconds are 0. This assumes that an hour of 24 is
632 permissible in any context. Restrictions on date-mday in <a href="#section-5.7">section 5.7</a>
633 apply. ISO 8601 states that the "T" may be omitted under some
634 circumstances. This grammar requires the "T" to avoid ambiguity.
635 ISO 8601 also requires (in <a href="#section-5.3.1.3">section 5.3.1.3</a>) that a decimal fraction
636 be proceeded by a "0" if less than unity. Annex B.2 of ISO 8601
637 gives examples where the decimal fractions are not preceded by a "0".
638 This grammar assumes <a href="#section-5.3.1.3">section 5.3.1.3</a> is correct and that Annex B.2 is
639 in error.
640
641 date-century = 2DIGIT ; 00-99
642 date-decade = DIGIT ; 0-9
643 date-subdecade = DIGIT ; 0-9
644 date-year = date-decade date-subdecade
645 date-fullyear = date-century date-year
646 date-month = 2DIGIT ; 01-12
647 date-wday = DIGIT ; 1-7 ; 1 is Monday, 7 is Sunday
648 date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
649 ; month/year
650 date-yday = 3DIGIT ; 001-365, 001-366 based on year
651 date-week = 2DIGIT ; 01-52, 01-53 based on year
652
653 datepart-fullyear = [date-century] date-year ["-"]
654 datepart-ptyear = "-" [date-subdecade ["-"]]
655 datepart-wkyear = datepart-ptyear / datepart-fullyear
656
657 dateopt-century = "-" / date-century
658 dateopt-fullyear = "-" / datepart-fullyear
659 dateopt-year = "-" / (date-year ["-"])
660 dateopt-month = "-" / (date-month ["-"])
661 dateopt-week = "-" / (date-week ["-"])
662
663
664
665
666
667
668 <span class="grey">Klyne, et. al. Standards Track [Page 12]</span></pre>
669 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
670 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
671
672
673 datespec-full = datepart-fullyear date-month ["-"] date-mday
674 datespec-year = date-century / dateopt-century date-year
675 datespec-month = "-" dateopt-year date-month [["-"] date-mday]
676 datespec-mday = "--" dateopt-month date-mday
677 datespec-week = datepart-wkyear "W"
678 (date-week / dateopt-week date-wday)
679 datespec-wday = "---" date-wday
680 datespec-yday = dateopt-fullyear date-yday
681
682 date = datespec-full / datespec-year
683 / datespec-month /
684 datespec-mday / datespec-week / datespec-wday / datespec-yday
685
686 Time:
687
688 time-hour = 2DIGIT ; 00-24
689 time-minute = 2DIGIT ; 00-59
690 time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on
691 ; leap-second rules
692 time-fraction = ("," / ".") 1*DIGIT
693 time-numoffset = ("+" / "-") time-hour [[":"] time-minute]
694 time-zone = "Z" / time-numoffset
695
696 timeopt-hour = "-" / (time-hour [":"])
697 timeopt-minute = "-" / (time-minute [":"])
698
699 timespec-hour = time-hour [[":"] time-minute [[":"] time-second]]
700 timespec-minute = timeopt-hour time-minute [[":"] time-second]
701 timespec-second = "-" timeopt-minute time-second
702 timespec-base = timespec-hour / timespec-minute / timespec-second
703
704 time = timespec-base [time-fraction] [time-zone]
705
706 iso-date-time = date "T" time
707
708 Durations:
709
710 dur-second = 1*DIGIT "S"
711 dur-minute = 1*DIGIT "M" [dur-second]
712 dur-hour = 1*DIGIT "H" [dur-minute]
713 dur-time = "T" (dur-hour / dur-minute / dur-second)
714 dur-day = 1*DIGIT "D"
715 dur-week = 1*DIGIT "W"
716 dur-month = 1*DIGIT "M" [dur-day]
717 dur-year = 1*DIGIT "Y" [dur-month]
718 dur-date = (dur-day / dur-month / dur-year) [dur-time]
719
720 duration = "P" (dur-date / dur-time / dur-week)
721
722
723
724 <span class="grey">Klyne, et. al. Standards Track [Page 13]</span></pre>
725 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
726 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
727
728
729 Periods:
730
731 period-explicit = iso-date-time "/" iso-date-time
732 period-start = iso-date-time "/" duration
733 period-end = duration "/" iso-date-time
734
735 period = period-explicit / period-start / period-end
736
737 <span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. Day of the Week</span>
738
739 The following is a sample C subroutine loosely based on Zeller's
740 Congruence [Zeller] which may be used to obtain the day of the week
741 for dates on or after 0000-03-01:
742
743 char *day_of_week(int day, int month, int year)
744 {
745 int cent;
746 char *dayofweek[] = {
747 "Sunday", "Monday", "Tuesday", "Wednesday",
748 "Thursday", "Friday", "Saturday"
749 };
750
751 /* adjust months so February is the last one */
752 month -= 2;
753 if (month &lt; 1) {
754 month += 12;
755 --year;
756 }
757 /* split by century */
758 cent = year / 100;
759 year %= 100;
760 return (dayofweek[((26 * month - 2) / 10 + day + year
761 + year / 4 + cent / 4 + 5 * cent) % 7]);
762 }
763
764 <span class="h2"><a class="selflink" id="appendix-C" href="#appendix-C">Appendix C</a>. Leap Years</span>
765
766 Here is a sample C subroutine to calculate if a year is a leap year:
767
768 /* This returns non-zero if year is a leap year. Must use 4 digit
769 year.
770 */
771 int leap_year(int year)
772 {
773 return (year % 4 == 0 &amp;&amp; (year % 100 != 0 || year % 400 == 0));
774 }
775
776
777
778
779
780 <span class="grey">Klyne, et. al. Standards Track [Page 14]</span></pre>
781 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
782 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
783
784
785 <span class="h2"><a class="selflink" id="appendix-D" href="#appendix-D">Appendix D</a>. Leap Seconds</span>
786
787 Information about leap seconds can be found at:
788 &lt;<a href="http://tycho.usno.navy.mil/leapsec.html">http://tycho.usno.navy.mil/leapsec.html</a>&gt;. In particular, it notes
789 that:
790
791 The decision to introduce a leap second in UTC is the
792 responsibility of the International Earth Rotation Service (IERS).
793 According to the CCIR Recommendation, first preference is given to
794 the opportunities at the end of December and June, and second
795 preference to those at the end of March and September.
796
797 When required, insertion of a leap second occurs as an extra second
798 at the end of a day in UTC, represented by a timestamp of the form
799 YYYY-MM-DDT23:59:60Z. A leap second occurs simultaneously in all
800 time zones, so that time zone relationships are not affected. See
801 <a href="#section-5.8">section 5.8</a> for some examples of leap second times.
802
803 The following table is an excerpt from the table maintained by the
804 United States Naval Observatory. The source data is located at:
805
806 &lt;<a href="ftp://maia.usno.navy.mil/ser7/tai-utc.dat">ftp://maia.usno.navy.mil/ser7/tai-utc.dat</a>&gt;
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 <span class="grey">Klyne, et. al. Standards Track [Page 15]</span></pre>
837 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
838 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
839
840
841 This table shows the date of the leap second, and the difference
842 between the time standard TAI (which isn't adjusted by leap seconds)
843 and UTC after that leap second.
844
845 UTC Date TAI - UTC After Leap Second
846 -------- ---------------------------
847 1972-06-30 11
848 1972-12-31 12
849 1973-12-31 13
850 1974-12-31 14
851 1975-12-31 15
852 1976-12-31 16
853 1977-12-31 17
854 1978-12-31 18
855 1979-12-31 19
856 1981-06-30 20
857 1982-06-30 21
858 1983-06-30 22
859 1985-06-30 23
860 1987-12-31 24
861 1989-12-31 25
862 1990-12-31 26
863 1992-06-30 27
864 1993-06-30 28
865 1994-06-30 29
866 1995-12-31 30
867 1997-06-30 31
868 1998-12-31 32
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892 <span class="grey">Klyne, et. al. Standards Track [Page 16]</span></pre>
893 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
894 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
895
896
897 Acknowledgements
898
899 The following people provided helpful advice for an earlier
900 incarnation of this document: Ned Freed, Neal McBurnett, David
901 Keegel, Markus Kuhn, Paul Eggert and Robert Elz. Thanks are also due
902 to participants of the IETF Calendaring/Scheduling working group
903 mailing list, and participants of the time zone mailing list.
904
905 The following reviewers contributed helpful suggestions for the
906 present revision: Tom Harsch, Markus Kuhn, Pete Resnick, Dan Kohn.
907 Paul Eggert provided many careful observations regarding the
908 subtleties of leap seconds and time zone offsets. The following
909 people noted corrections and improvements to earlier drafts: Dr John
910 Stockton, Jutta Degener, Joe Abley, and Dan Wing.
911
912 Authors' Addresses
913
914 Chris Newman
915 Sun Microsystems
916 1050 Lakes Drive, Suite 250
917 West Covina, CA 91790 USA
918
919 EMail: [email protected]
920
921
922 Graham Klyne (editor, this revision)
923 Clearswift Corporation
924 1310 Waterside
925 Arlington Business Park
926 Theale, Reading RG7 4SA
927 UK
928
929 Phone: +44 11 8903 8903
930 Fax: +44 11 8903 9000
931 EMail: [email protected]
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948 <span class="grey">Klyne, et. al. Standards Track [Page 17]</span></pre>
949 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
950 <span class="grey"><a href="./rfc3339">RFC 3339</a> Date and Time on the Internet: Timestamps July 2002</span>
951
952
953 Full Copyright Statement
954
955 Copyright (C) The Internet Society (2002). All Rights Reserved.
956
957 This document and translations of it may be copied and furnished to
958 others, and derivative works that comment on or otherwise explain it
959 or assist in its implementation may be prepared, copied, published
960 and distributed, in whole or in part, without restriction of any
961 kind, provided that the above copyright notice and this paragraph are
962 included on all such copies and derivative works. However, this
963 document itself may not be modified in any way, such as by removing
964 the copyright notice or references to the Internet Society or other
965 Internet organizations, except as needed for the purpose of
966 developing Internet standards in which case the procedures for
967 copyrights defined in the Internet Standards process must be
968 followed, or as required to translate it into languages other than
969 English.
970
971 The limited permissions granted above are perpetual and will not be
972 revoked by the Internet Society or its successors or assigns.
973
974 This document and the information contained herein is provided on an
975 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
976 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
977 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
978 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
979 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
980
981 Acknowledgement
982
983 Funding for the RFC Editor function is currently provided by the
984 Internet Society.
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004 Klyne, et. al. Standards Track [Page 18]
1005 </pre>