5 Network Working Group C. Newman
6 Internet Draft: Date and Time on the Internet Innosoft
7 Document: draft-newman-datetime-00.txt December 1996
10 Date and Time on the Internet
15 This document is an Internet Draft. Internet Drafts are working
16 documents of the Internet Engineering Task Force (IETF), its Areas,
17 and its Working Groups. Note that other groups may also distribute
18 working documents as Internet Drafts.
20 Internet Drafts are draft documents valid for a maximum of six
21 months. Internet Drafts may be updated, replaced, or obsoleted by
22 other documents at any time. It is not appropriate to use Internet
23 Drafts as reference material or to cite them other than as a
24 ``working draft'' or ``work in progress``.
26 To learn the current status of any Internet-Draft, please check the
27 1id-abstracts.txt listing contained in the Internet-Drafts Shadow
28 Directories on ds.internic.net, nic.nordu.net, ftp.isi.edu, or
31 A revised version of this draft document will be submitted to the
32 IESG as a Proposed Standard for the Internet Community. Discussion
33 and suggestions for improvement are requested. This document will
34 expire six months after publication. Distribution of this draft is
41 Date and time formats cause a lot of confusion and interoperability
42 problems on the Internet. This document will address many of the
43 problems encountered and make recommendations to improve
44 consistancy and interoperability when representing and using date
45 and time in Internet protocols.
47 This document includes an Internet profile of the ISO 8601
48 [ISO8601] standard for representation of dates and times.
50 [More detail work is needed, but I wanted to get this out before I
51 go on vacation to see if it meets the basic requirements coming
52 from the ASID and CALSCH working groups. Places needing work are
58 Internet Draft Date and Time December 1996
66 UTC Coordinated Universal Time as maintained by the Bureau
67 Internaational de l'Heure (International Time Bureau).
69 [XXX definitely need more definitions here. It would be nice to
70 reference a good time standard to define seconds, leap years, etc.]
72 3. Two or Three Digit Years
74 Two digit years are expected to cause great expense to many as the
75 year 2000 approaches. Many existing computer programs simply add
76 or subtract 1900 from a two digit year. Such programs will clearly
77 stop functioning on the year 2000 and will have to be upgraded,
78 possibly at great expense [XXX - ref to Wall Street Journal article
79 on IRS year 2000 problems would be cool]. The following
80 requirements are made of Internet protocols to address this
83 o Internet Protocols MUST generate four digit years in dates.
85 o If a two digit year is received, the values 00-49 SHOULD be
86 interpreted as referring to the 21st century (add 2000) and the
87 values 50-99 SHOULD be interpreted as referring to the 20th century
90 o Three digit years MUST be interpreted by adding 1900.
95 4.1. Coordinated Universal Time (UTC)
97 Because the daylight rules for local timezones are so convoluted
98 [XXX-ref], true interoperability is best achieved by using
99 Coordinated Universal Time (UTC) [XXX-ref].
104 The offset between local time and UTC is often useful information.
105 For example, in electronic mail [IMAIL] the local offset provides a
106 useful heuristic to determine the probability of a prompt response.
107 Attempts to label local offsets with alphabetic strings have met
108 with poor interoperability results in the past [IMAIL], [HOST-REQ].
114 Internet Draft Date and Time December 1996
117 Therefore numeric offsets are now REQUIRED. When the local offset
118 is unknown, the offset "-00:00" MAY be used to indicate that the
119 time is in UTC and the local offset is unknown.
122 4.3. Unqualified Local Time
124 A number of devices currently connected to the Internet run their
125 internal clocks in local time and are unaware of UTC. While the
126 Internet does have a tradition of accepting reality when creating
127 specifications, this should not be done at the expense of
128 interoperability. Since interpretation of an unqualified local
129 timezone will fail in approximately 23/24 of the globe, the
130 interoperability problems of unqualified local time are deemed
131 unacceptable for the Internet. Devices which are unaware of the
132 time in UTC MUST use one of the following techniques when
133 communicating on the Internet:
135 o Use Network Time Protocol [NTP] to obtain the time in UTC.
137 o Use another host in the same local timezone as a gateway to the
138 Internet. This host MUST correct unqualified local times before
139 they are transmitted to other hosts.
141 o Prompt the user for the local timezone if it is aware of the
142 daylight rules. One technique to do this is by having the user
143 select a major city in their timezone. An alternative would be to
144 show a list of the timezone labels defined in [section XXX].
147 5. Date and Time formats
149 The date and time format defined in [IMAIL] and as amended by
150 [HOST-REQ] may be referred to as "the Internet Mail Date/Time
151 Format". The profile of ISO 8601 defined in this section may be
152 referred to as "the Internet Date/Time Format". The following
153 sections describe useful properties of a date and time format for
154 interchange on the Internet.
159 If date and time components are ordered from least precise to most
160 precise, then a useful property is achieved. Assuming that the
161 timezones of the dates and times are the same (e.g. all in UTC),
162 then the date and time strings may be sorted as strings (e.g. using
163 the strcmp() function in C) and a time-ordered sequence will
164 result. The presence of optional punctuation would violate this
170 Internet Draft Date and Time December 1996
176 5.2. Human Readability
178 Human readability has proved to be a valuable feature of Internet
179 protocols. Human readable protocols greatly reduce the costs of
180 debugging since telnet often suffices as a test client and network
181 analysers need not be modified with knowledge of the protocol. On
182 the other hand, human readability sometimes results in
183 interoperability problems. For example, the date format
184 "10/11/1996" is completely unsuitable for global interchange
185 because it is interpreted differently in different countries. In
186 addition, the date format in [IMAIL] has resulted in
187 interoperability problems when people assumed it was simply a text
188 string and translated the three letter abbreviations to other
189 languages or substituted date formats which were easier to generate
190 (e.g. the format used by the C function ctime). For this reason, a
191 balance must be struck between human readability and
194 Because no date and time format is readable according to the
195 conventions of all countries, Internet clients SHOULD be prepared
196 to transform dates into a display format suitable for the locality.
197 This includes translating UTC to local time.
202 The complete set of date and time formats specified in ISO 8601
203 [ISO8601] is quite complex in an attempt to provide multiple
204 representations and partial representations. Appendix A contains
205 an attempt to translate the complete syntax of ISO 8601 into ABNF
206 as defined in [IMAIL]. Internet protocols have somewhat different
207 requirements and simplicity has proved to be an important
208 characteristic. In addition, Internet protocols usually need
209 complete specification of data in order to achieve true
210 interoperability. Therefore, the complete grammar for ISO 8601 is
211 deemed too complex for most Internet protocols.
213 The following section defines an profile of ISO 8601 for use on the
214 Internet. It is a conformant subset of the ISO 8601 extended
215 format. Simplicity is achieved by making most fields and
216 punctuation mandatory.
219 5.4. Internet Date/Time Format
226 Internet Draft Date and Time December 1996
229 The following profile of ISO 8601 [ISO8601] dates SHOULD be used in
230 new protocols on the Internet. This is specified using ABNF as
233 date-fullyear = 4DIGIT
234 date-month = 2DIGIT ; 01-12
235 date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year
236 time-hour = 2DIGIT ; 00-24
237 time-minute = 2DIGIT ; 00-59
238 time-second = 2DIGIT ; 00-60
239 time-secfrac = "," 1*DIGIT
240 time-numzone = ("+" / "-") time-hour ":" time-minute
241 time-zone = "Z" / time-numzone
243 full-date = date-fullyear "-" date-month "-" date-mday
244 full-time = time-hour ":" time-minute ":" time-second
245 [time-secfrac] time-zone
247 date-time = full-date "T" full-time
252 Here are two examples of this date and time format.
254 1985-04-12T23:20:50,5Z
256 This represents 20 minutes and 50.5 seconds after 11 PM on April
259 1996-12-19T16:39:57-08:00
261 This represents 39 minutes and 57 seconds after 4 PM on December
262 19th, 1996 with an offset of -08:00 from UTC (Pacific Standard
266 6. IANA Registry of Timezone Names
268 [XXX - put good stuff here]
273 [ISO8601] "Data elements and interchange formats -- Information
274 interchange -- Representation of dates and times", ISO 8601:1988(E),
275 International Organization for Standardization, June, 1988.
282 Internet Draft Date and Time December 1996
285 [IMAIL] Crocker, D., "Standard for the Format of Arpa Internet Text
286 Messages", RFC 822, University of Delaware, August 1982.
288 <ftp://ds.internic.net/rfc/rfc822.txt>
290 [HOST-REQ] Braden, R., "Requirements for Internet Hosts -- Application
291 and Support", RFC 1123, Internet Engineering Task Force, October 1989.
293 <ftp://ds.internic.net/rfc/rfc1123.txt>
295 [NTP] Mills, D., "Network Time Protocol version 2 specification and
296 implementation", RFC 1119, September 1989.
298 <ftp://ds.internic.net/rfc/rfc1119.ps>
301 8. Security Considerations
303 Since the local time zone of a site may be useful for determining a
304 time when systems are less likely to be monitored and might be more
305 susceptible to a security probe, some sites may wish to emit times
306 in UTC only. Others might consider this to be loss of useful
307 functionality at the hands of paranoia.
313 Innosoft International, Inc.
314 1050 East Garvey Ave. South
315 West Covina, CA 91790 USA
317 Email: chris.newman@innosoft.com
321 A. ISO 8601 Collected ABNF
323 ISO 8601 does not specify a formal grammar for the date and time
324 formats it defines. The following is an attempt to create a formal
325 grammar from ISO 8601. This is informational only and may contain
326 errors. ISO 8601 remains the authoratative reference for the
329 date-century = 2DIGIT ; 00-99
330 date-decade = DIGIT ; 0-9
331 date-subdecade = DIGIT ; 0-9
332 date-year = date-decade date-subdecade
338 Internet Draft Date and Time December 1996
341 date-fullyear = date-century date-year
342 date-month = 2DIGIT ; 01-12
343 date-wday = DIGIT ; 1-7 ; 1 is Monday, 7 is Sunday
344 date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year
345 date-yday = 3DIGIT ; 001-365, 001-366 based on year
346 date-week = 2DIGIT ; 01-52, 01-53 based on year
348 datepart-fullyear = [date-century] date-year ["-"]
349 datepart-ptyear = "-" [date-subdecade ["-"]]
350 datepart-wkyear = datepart-ptyear / datepart-fullyear
352 dateopt-century = "-" / date-century
353 dateopt-fullyear = "-" / datepart-fullyear
354 dateopt-year = "-" / (date-year ["-"])
355 dateopt-month = "-" / (date-month ["-"])
356 dateopt-week = "-" / (date-week ["-"])
358 datespec-full = datepart-fullyear date-month ["-"] date-mday
359 datespec-year = date-century / dateopt-century date-year
360 datespec-month = "-" dateopt-year date-month [["-"] date-mday]
361 datespec-mday = "--" dateopt-month date-mday
362 datespec-week = datepart-wkyear "W" (date-week / dateopt-week date-wday)
363 datespec-wday = "---" date-wday
364 datespec-yday = dateopt-fullyear date-yday
366 date = datespec-full / datespec-year / datespec-month /
367 datespec-mday / datespec-week / datespec-wday / datespec-yday
371 time-hour = 2DIGIT ; 00-24
372 time-minute = 2DIGIT ; 00-59
373 time-second = 2DIGIT ; 00-60
374 time-fraction = ("," / ".") 1*DIGIT
375 time-numzone = ("+" / "-") time-hour [[":"] time-minute]
376 time-zone = "Z" / time-numzone
378 timeopt-hour = "-" / (time-hour [":"])
379 timeopt-minute = "-" / (time-minute [":"])
381 timespec-hour = time-hour [[":"] time-minute [[":"] time-second]]
382 timespec-minute = timeopt-hour time-minute [[":"] time-second]
383 timespec-second = "-" timeopt-minute time-second
384 timespec-base = timespec-hour / timespec-minute / timespec-second
386 time = timespec-base [time-fraction] [time-zone]
388 iso-date-time = date "T" time
394 Internet Draft Date and Time December 1996
399 dur-second = 1*DIGIT "S" dur-minute = 1*DIGIT "M"
400 [dur-second] dur-hour = 1*DIGIT "H" [dur-minute] dur-time
401 = "T" (dur-hour / dur-minute / dur-second) dur-day =
402 1*DIGIT "D" dur-week = 1*DIGIT "W" dur-month =
403 1*DIGIT "M" [dur-day] dur-year = 1*DIGIT "Y" [dur-month]
404 dur-date = (dur-day / dur-month / dur-year) [dur-time]
406 duration = "P" (dur-date / dur-time / dur-week)
410 period-explicit = date-time "/" date-time period-start =
411 date-time "/" duration period-end = duration "/" date-time
413 period = period-explicit / period-start / period-end
416 B. Zeller's Congruence [XXX-ref]
418 The following is sample C code which may be used to obtain the day
421 char *dayofweek[] = {
422 "Sunday", "Monday", "Tuesday", "Wednesday",
423 "Thursday", "Friday", "Saturday"
428 int cent, year, day, month;
430 printf("Enter the year (4 digits): ");
432 printf("\nEnter the month (1-12): ");
434 printf("\nEnter the day of the month (1-31): ");
443 printf("The day of the week is: %s\n",
444 dayofweek[((26 * month - 2) / 10 + day + year
450 Internet Draft Date and Time December 1996
453 + year / 4 + cent / 4 - 2 * cent) % 7]);