home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_n_r / draft-newman-datetime-01.txt < prev    next >
Text File  |  1997-01-28  |  48KB  |  1,289 lines

  1.  
  2.  
  3.  
  4. Network Working Group                                          C. Newman
  5. Internet Draft: Date and Time on the Internet                   Innosoft
  6. Document: draft-newman-datetime-01.txt                      January 1997
  7.  
  8.  
  9.                      Date and Time on the Internet
  10.  
  11.  
  12. Status of this memo
  13.  
  14.      This document is an Internet Draft.  Internet Drafts are working
  15.      documents of the Internet Engineering Task Force (IETF), its Areas,
  16.      and its Working Groups.  Note that other groups may also distribute
  17.      working documents as Internet Drafts.
  18.  
  19.      Internet Drafts are draft documents valid for a maximum of six
  20.      months.  Internet Drafts may be updated, replaced, or obsoleted by
  21.      other documents at any time.  It is not appropriate to use Internet
  22.      Drafts as reference material or to cite them other than as a
  23.      ``working draft'' or ``work in progress``.
  24.  
  25.      To learn the current status of any Internet-Draft, please check the
  26.      1id-abstracts.txt listing contained in the Internet-Drafts Shadow
  27.      Directories on ds.internic.net, nic.nordu.net, ftp.isi.edu, or
  28.      munnari.oz.au.
  29.  
  30.      A revised version of this draft document will be submitted to the
  31.      IESG as a Proposed Standard for the Internet Community.  Discussion
  32.      and suggestions for improvement are requested.  This document will
  33.      expire six months after publication.  Distribution of this draft is
  34.      unlimited.
  35.  
  36.  
  37.  
  38. 1. Introduction
  39.  
  40.      Date and time formats cause a lot of confusion and interoperability
  41.      problems on the Internet.  This document will address many of the
  42.      problems encountered and make recommendations to improve
  43.      consistancy and interoperability when representing and using date
  44.      and time in Internet protocols.
  45.  
  46.      This document includes an Internet profile of the ISO 8601
  47.      [ISO8601] standard for representation of dates and times using the
  48.      Gregorian calendar.
  49.  
  50.      Changes from draft -00:
  51.       * added some more definitions and references (fixed NTP reference)
  52.  
  53.  
  54.  
  55. Newman                                                          [Page 1]
  56.  
  57. Internet Draft               Date and Time                  January 1997
  58.  
  59.  
  60.       * language clarifications
  61.       * include rules for day of month and leap seconds
  62.       * disallow hour of 24
  63.       * add registry of named timezones and local time format
  64.       * use . instead of , for fractions of second
  65.       * removed references to AM/PM
  66.       * simplified appendix B program
  67.       * added appendix C program to calculate leap year
  68.  
  69.      Controversial in last draft, but unchanged:
  70.       * use of "T" as date/time separator.  Proposal is to use " " instead,
  71.         but my reading of ISO 8601 does not permit that.
  72.       * suggestion to make minutes offset from UTC optional.
  73.       * interpretation of 2 digit years
  74.  
  75.      Open issues:
  76.       * See controversial issues above.  More comment is welcome.
  77.       * Are more definitions needed?
  78.       * A number of the timezones in the initial registry list are
  79.         duplicates for future times.  I already removed the Indiana county
  80.         ones since they all duplicate Indianapolis for future times.
  81.       * Need reference to good article demonstrating year 2000 problems.
  82.       * Need commentary on registry and to set up address for registry.
  83.       * Will add appendix D, E with sample POSIX generation/parsing code
  84.         for section 5.6.  Markus Kuhn is working on code.
  85.  
  86.  
  87. 2. Definitions
  88.  
  89.      UTC         Coordinated Universal Time as maintained by the Bureau
  90.                  Internaational de l'Heure (International Time Bureau).
  91.  
  92.      second      A basic unit of measurement of time in the
  93.                  International System of Units.
  94.  
  95.      minute      A period of time of 60 seconds.
  96.  
  97.      hour        A period of time of 60 minutes.
  98.  
  99.      day         A period of time of 24 hours.
  100.  
  101.      leap year   In the Gregorian calendar, a year which has 366 days.
  102.                  A leap year is a year whose number is divisible by four
  103.                  an integral number of times, except that if it is a
  104.                  centennial year it shall be divisible by four hundred
  105.                  an integral number of times.
  106.  
  107.      ABNF        Augmented Backus-Naur Form, a format used to represent
  108.  
  109.  
  110.  
  111. Newman                                                          [Page 2]
  112.  
  113. Internet Draft               Date and Time                  January 1997
  114.  
  115.  
  116.                  permissible strings in a protocol or language, as
  117.                  defined in [IMAIL].
  118.  
  119.      Email Date/Time Format
  120.                  The date/time format used by Internet Mail as defined
  121.                  by RFC 822 [IMAIL] and amended by RFC 1123 [HOST-REQ].
  122.  
  123.      Internet Date/Time Format
  124.                  The date format defined in section 5 of this document.
  125.  
  126.      For more information about time scales, see Appendix E of [NTP],
  127.      Section 3 of [ISO8601], and the appropriate ITU documents [ITU-R-
  128.      TF].
  129.  
  130.  
  131. 3. Two Digit Years
  132.  
  133.      Two digit years are expected to cause great expense to many as the
  134.      year 2000 approaches.  Many existing computer programs simply add
  135.      or subtract 1900 from a two digit year.  Such programs will clearly
  136.      stop functioning on the year 2000 and will have to be upgraded,
  137.      possibly at great expense [XXX - ref to article on IRS year 2000
  138.      problems would be cool].  The following requirements are made of
  139.      Internet protocols to address this problem:
  140.  
  141.      o  Internet Protocols MUST generate four digit years in dates.
  142.  
  143.      o  If a two digit year is received, the values 00-49 MUST be
  144.         interpreted as referring to the 21st century (add 2000) and the
  145.         values 50-99 MUST be interpreted as referring to the 20th
  146.         century (add 1900).  While different interpretations may result
  147.         in a few more years of 2-digit usability for some applications,
  148.         it is believed that a single interpretation for two digit years
  149.         in all Internet protocols will result in better
  150.         interoperability.  In addition, it is reasonable to expect all
  151.         Internet Protocols using 2 digit dates to be upgraded by the
  152.         year 2050.
  153.  
  154.      o  It is possible that a program using two digit years will
  155.         represent years after 1999 as three digits.  This occurs if the
  156.         program simply subtracts 1900 from the year and doesn't check
  157.         the number of digits.  Programs wishing to robustly deal with
  158.         dates generated by such broken software may add 1900 to three
  159.         digit years.
  160.  
  161.      o  It is possible that a program using two digit years will
  162.         represent years after 1999 as ":0", ":1", ... ":9", ";0", ...
  163.         This occurs if the program simply subtracts 1900 from the year
  164.  
  165.  
  166.  
  167. Newman                                                          [Page 3]
  168.  
  169. Internet Draft               Date and Time                  January 1997
  170.  
  171.  
  172.         and adds the decade to the US-ASCII character zero. Programs
  173.         wishing to robustly deal with dates generated by such broken
  174.         software should detect non-numeric decades and interpret
  175.         appropriately.
  176.  
  177.      The problems with two digit years amply demonstrate why all dates
  178.      and times used in Internet protocols MUST be fully qualified.
  179.  
  180.  
  181. 4. Local Time
  182.  
  183. 4.1. Coordinated Universal Time (UTC)
  184.  
  185.      Because the daylight rules for local timezones are so convoluted
  186.      and can change based on local law at unpredictable times, true
  187.      interoperability is best achieved by using Coordinated Universal
  188.      Time (UTC).
  189.  
  190.  
  191. 4.2. Local Offsets
  192.  
  193.      The offset between local time and UTC is often useful information.
  194.      For example, in electronic mail [IMAIL] the local offset provides a
  195.      useful heuristic to determine the probability of a prompt response.
  196.      Attempts to label local offsets with alphabetic strings have
  197.      resulted in poor interoperability in the past [IMAIL], [HOST-REQ].
  198.      Therefore numeric offsets are now REQUIRED in Internet Mail
  199.      Date/Time Format.
  200.  
  201.      Numeric offsets are calculated as "local time minus UTC".  So the
  202.      equivalent time in UTC can be determined by subtracting the offset
  203.      from the local time.  For example, 18:50:00-04:00 is the same time
  204.      as 22:58:00Z.
  205.  
  206.  
  207. 4.3. Unknown Local Offset Convention
  208.  
  209.      If the time in UTC is known, but the offset to local time is
  210.      unknown, this can be represented with an offset of "-00:00".  This
  211.      differs semanticly from an offset of "Z" which implies that UTC is
  212.      the preferred reference point for the specified time.  This
  213.      convention MAY also be used in the Email Date/Time Format.
  214.  
  215.  
  216. 4.4. Unqualified Local Time
  217.  
  218.      A number of devices currently connected to the Internet run their
  219.      internal clocks in local time and are unaware of UTC.  While the
  220.  
  221.  
  222.  
  223. Newman                                                          [Page 4]
  224.  
  225. Internet Draft               Date and Time                  January 1997
  226.  
  227.  
  228.      Internet does have a tradition of accepting reality when creating
  229.      specifications, this should not be done at the expense of
  230.      interoperability.  Since interpretation of an unqualified local
  231.      timezone will fail in approximately 23/24 of the globe, the
  232.      interoperability problems of unqualified local time are deemed
  233.      unacceptable for the Internet.  Devices which are unaware of the
  234.      time in UTC MUST use one of the following techniques when
  235.      communicating on the Internet:
  236.  
  237.      o  Use Network Time Protocol [NTP] to obtain the time in UTC.
  238.  
  239.      o  Use another host in the same local timezone as a gateway to the
  240.         Internet.  This host MUST correct unqualified local times before
  241.         they are transmitted to other hosts.
  242.  
  243.      o  Prompt the user for the local timezone and daylight savings
  244.         settings.
  245.  
  246. 5. Date and Time formats
  247.  
  248.      This section discusses desirable qualities of date and time formats
  249.      and defines a profile of ISO 8601 for use in new Internet
  250.      protocols.  Email Date/Time Format lacks many of these
  251.      characteristics and its use in new protocols is discouraged.
  252.  
  253.  
  254. 5.1. Ordering
  255.  
  256.      If date and time components are ordered from least precise to most
  257.      precise, then a useful property is achieved.  Assuming that the
  258.      timezones of the dates and times are the same (e.g. all in UTC),
  259.      then the date and time strings may be sorted as strings (e.g. using
  260.      the strcmp() function in C) and a time-ordered sequence will
  261.      result.  The presence of optional punctuation would violate this
  262.      characteristic.
  263.  
  264.  
  265. 5.2. Human Readability
  266.  
  267.      Human readability has proved to be a valuable feature of Internet
  268.      protocols.  Human readable protocols greatly reduce the costs of
  269.      debugging since telnet often suffices as a test client and network
  270.      analysers need not be modified with knowledge of the protocol.  On
  271.      the other hand, human readability sometimes results in
  272.      interoperability problems.  For example, the date format
  273.      "10/11/1996" is completely unsuitable for global interchange
  274.      because it is interpreted differently in different countries.  In
  275.      addition, the date format in [IMAIL] has resulted in
  276.  
  277.  
  278.  
  279. Newman                                                          [Page 5]
  280.  
  281. Internet Draft               Date and Time                  January 1997
  282.  
  283.  
  284.      interoperability problems when people assumed any text string was
  285.      permitted and translated the three letter abbreviations to other
  286.      languages or substituted date formats which were easier to generate
  287.      (e.g. the format used by the C function ctime).  For this reason, a
  288.      balance must be struck between human readability and
  289.      interoperability.
  290.  
  291.      Because no date and time format is readable according to the
  292.      conventions of all countries, Internet clients SHOULD be prepared
  293.      to transform dates into a display format suitable for the locality.
  294.      This may include translating UTC to local time.
  295.  
  296.  
  297. 5.3. Rarely Used Options
  298.  
  299.      A format which includes rarely used options is likely to cause
  300.      interoperability problems.  This is because rarely used options are
  301.      less likely to be used in alpha or beta testing, so bugs in parsing
  302.      are less likely to be discovered.  Rarely used options should be
  303.      made mandatory or omitted for the sake of interoperability whenever
  304.      possible.
  305.  
  306.      The format defined below includes only one rarely used option:
  307.      fractions of a second.  It is expected that this will be used only
  308.      by applications which require strict ordering of date/time stamps
  309.      or which have an unusual precision requirement.
  310.  
  311.  
  312. 5.4. Redundant Information
  313.  
  314.      If a date/time format includes redundant information, that
  315.      introduces the possibility that the redunant information will not
  316.      correlate.  For example, including the day of the week in a
  317.      date/time format introduces the possibility that the day of week is
  318.      incorrect but the date is correct, or vice versa.  Since it is not
  319.      difficult to compute the day of week from a date (see Appendix B),
  320.      the day of week should not be included in a date/time format.
  321.  
  322.  
  323. 5.5. Simplicity
  324.  
  325.      The complete set of date and time formats specified in ISO 8601
  326.      [ISO8601] is quite complex in an attempt to provide multiple
  327.      representations and partial representations.  Appendix A contains
  328.      an attempt to translate the complete syntax of ISO 8601 into ABNF
  329.      as defined in [IMAIL].  Internet protocols have somewhat different
  330.      requirements and simplicity has proved to be an important
  331.      characteristic.  In addition, Internet protocols usually need
  332.  
  333.  
  334.  
  335. Newman                                                          [Page 6]
  336.  
  337. Internet Draft               Date and Time                  January 1997
  338.  
  339.  
  340.      complete specification of data in order to achieve true
  341.      interoperability.  Therefore, the complete grammar for ISO 8601 is
  342.      deemed too complex for most Internet protocols.
  343.  
  344.      The following section defines a profile of ISO 8601 for use on the
  345.      Internet.  It is a conformant subset of the ISO 8601 extended
  346.      format.  Simplicity is achieved by making most fields and
  347.      punctuation mandatory.
  348.  
  349.  
  350. 5.6. Internet Date/Time Format
  351.  
  352.      The following profile of ISO 8601 [ISO8601] dates SHOULD be used in
  353.      new protocols on the Internet.  This is specified using ABNF as
  354.      defined in [IMAIL].
  355.  
  356.      date-fullyear   = 4DIGIT
  357.      date-month      = 2DIGIT  ; 01-12
  358.      date-mday       = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on month/year
  359.      time-hour       = 2DIGIT  ; 00-23
  360.      time-minute     = 2DIGIT  ; 00-59
  361.      time-second     = 2DIGIT  ; 00-59, 00-60 based on leap second rules
  362.      time-secfrac    = "." 1*DIGIT
  363.      time-numoffset  = ("+" / "-") time-hour ":" time-minute
  364.      time-offset     = "Z" / time-numoffset
  365.  
  366.      partial-time    = time-hour ":" time-minute ":" time-second
  367.                        [time-secfrac]
  368.      full-date       = date-fullyear "-" date-month "-" date-mday
  369.      full-time       = partial-time time-offset
  370.  
  371.      date-time       = full-date "T" full-time
  372.  
  373.  
  374. 5.7. Restrictions
  375.  
  376.      The grammar element date-mday represents the day number within the
  377.      current month.  The maximum value varies based on the month and
  378.      year as follows:
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391. Newman                                                          [Page 7]
  392.  
  393. Internet Draft               Date and Time                  January 1997
  394.  
  395.  
  396.      Month Number  Month/Year           Maximum value of date-mday
  397.      ------------  ----------           --------------------------
  398.      01            January              31
  399.      02            February, normal     28
  400.      02            February, leap year  29
  401.      03            March                31
  402.      04            April                30
  403.      05            May                  31
  404.      06            June                 30
  405.      07            July                 31
  406.      08            August               31
  407.      09            September            30
  408.      10            October              31
  409.      11            November             30
  410.      12            December             31
  411.  
  412.      Appendix C contains sample C code to determine if a year is a leap
  413.      year.
  414.  
  415.      The grammar element time-second may have the value "60" at the end
  416.      of June (XXXX-06-30T23:59:60) or December (XXXX-12-31T23:59:60).
  417.      At all other times the maximum value of time-second is "59".
  418.  
  419.      Although ISO 8601 permits the hour to be "24", this profile of ISO
  420.      8601 only allows values between "00" and "23" for the hour in order
  421.      to reduce confusion.
  422.  
  423.  
  424. 5.8. Examples
  425.  
  426.      Here are three examples of Internet date/time format.
  427.  
  428.      1985-04-12T23:20:50.52Z
  429.  
  430.      This represents 20 minutes and 50.52 seconds after the 23rd hour of
  431.      April 12th, 1985 in UTC.
  432.  
  433.      1996-12-19T16:39:57-08:00
  434.  
  435.      This represents 39 minutes and 57 seconds after the 16th hour of
  436.      December 19th, 1996 with an offset of -08:00 from UTC (Pacific
  437.      Standard Time).  Note that this is equivalent to 1996-12-
  438.      20T00:39:57Z in UTC.
  439.  
  440.      1990-12-31T23:59:60Z
  441.  
  442.      This represents the leap second insertted at the end of 1990.
  443.  
  444.  
  445.  
  446.  
  447. Newman                                                          [Page 8]
  448.  
  449. Internet Draft               Date and Time                  January 1997
  450.  
  451.  
  452. 6. Future Events in Local Time
  453.  
  454.      Some applications (e.g. calendaring) require the representation of
  455.      repeating or future dates in local time.  Because the conversion
  456.      rules between UTC and local time may change by season and political
  457.      whim, it is necessary to label the local time zone with a standard
  458.      label so that if new conversion rules are issued the interpretation
  459.      of the time relative to UTC can be corrected.  For this reason, an
  460.      IANA registry of timezone names which may be used to represent
  461.      future dates is necessary.
  462.  
  463.  
  464. 6.1. Problems Too Hard to Solve
  465.  
  466.      Since local timezone rules are set by local governments, the only
  467.      authoratative reference for such rules is those governments, most
  468.      of which do not currently provide their rules on line in a computer
  469.      parsible format.  In addition, local timezones were historically
  470.      set by cities and towns, so attempting to exhaustively enumerate
  471.      all historical timezones for use in representing past dates is not
  472.      practical.  Attempting to predict where new timezones will be
  473.      created as a subset of the area covered by an old timezone is also
  474.      a hopeless prospect.
  475.  
  476.      Therefore the only formal part of the registry will be names for a
  477.      minimal set of modern timezones.  As a convenience, the registry
  478.      will also include the base UTC offset and daylight savings rules
  479.      (if determinable) at the time of registration.  Because the UTC
  480.      offset and rules may changed by other bodies, they will not be
  481.      considered an authoratative part of the registry.
  482.  
  483.  
  484. 6.2. Prior Art
  485.  
  486.      An informal collection of timezone information is currently being
  487.      maintained by volunteer Internet participants.  The current
  488.      location of this information is:
  489.  
  490.           <ftp://elsie.nci.nih.gov/pub/>
  491.  
  492.      This is valuable work, and is used in some operating systems.  The
  493.      initial set of timezone names for the IANA registry is a subset of
  494.      the names collected by this effort.
  495.  
  496.  
  497. 6.3. Legal Characters in Timezone Names
  498.  
  499.      Only the US-ASCII characters A-Z, a-z, 0-9, "-", "_" and "/" are
  500.  
  501.  
  502.  
  503. Newman                                                          [Page 9]
  504.  
  505. Internet Draft               Date and Time                  January 1997
  506.  
  507.  
  508.      legal in timezone names.  The basic format is the name of a
  509.      continent or ocean followed by a "/" followed by the name of a city
  510.      or political entity.  A political entity may be followed by a "/"
  511.      and a subentity if necessary.  Timezone names SHOULD use the
  512.      standard case in the registry, but MUST be interpreted in a case
  513.      insensitive manner.   New timezone names SHOULD use "-" rather than
  514.      "_", as the latter is difficult to see in some output contexts.
  515.  
  516.  
  517. 6.4. Template for IANA Registration of Timezone Names
  518.  
  519.      To: timezone@XXX
  520.      Subject: Timezone Name Registration
  521.  
  522.      Timezone Name:
  523.  
  524.      ISO 3166 2-character country code:
  525.  
  526.      Description:
  527.  
  528.  
  529. 6.5. Proceedure for IANA Registration of Timezone Names
  530.  
  531.      The IESG is responsible for appointing a reviewer of Timezone
  532.      Names.  The job of this reviewer is to verify that the new timezone
  533.      name has unique UTC rules, is likely to be used, fits the rules in
  534.      section 6.3 and does not conflict unnecessarily with prior art
  535.      (especially that mentioned in section 6.2).  Within two weeks of
  536.      posting, the reviewer must take one of the following actions:
  537.  
  538.      (1) Pass the registration proposal to IANA.
  539.  
  540.      (2) Reject the registration proposal.
  541.  
  542.      (3) Recommend alterations to the registration proposal likely to make
  543.          it acceptable.
  544.  
  545.      In order to assist the reviewer, the address timezone@XXX will be a
  546.      public mailing list where registration proposals may be discussed.
  547.      Subscription and unsubscription requests may be sent to timezone-
  548.      request@XXX.
  549.  
  550.  
  551. 6.6. Initial List of IANA Timezone Names
  552.  
  553.      The following list will serve as the initial list of IANA Timezone
  554.      Names.  This list was generated from the archive mentioned in
  555.      section 6.2.  Some of these timezone names (especially within the
  556.  
  557.  
  558.  
  559. Newman                                                         [Page 10]
  560.  
  561. Internet Draft               Date and Time                  January 1997
  562.  
  563.  
  564.      same country) are redundant for future dates, but compatibility
  565.      with the timezone names in the databases discussed section 6.2. is
  566.      useful.
  567.  
  568.      Timezone Name                    Country
  569.      -------------                    -------
  570.      Europe/Andorra                     AD
  571.      Asia/Dubai                         AE
  572.      Asia/Kabul                         AF
  573.      America/Antigua                    AG
  574.      America/Anguilla                   AI
  575.      Europe/Tirane                      AL
  576.      Asia/Yerevan                       AM
  577.      America/Curacao                    AN
  578.      Africa/Luanda                      AO
  579.      Antarctica/Casey                   AQ
  580.      Antarctica/DumontDUrville          AQ
  581.      Antarctica/Mawson                  AQ
  582.      Antarctica/McMurdo                 AQ
  583.      Antarctica/Palmer                  AQ
  584.      Antarctica/South_Pole              AQ
  585.      America/Buenos_Aires               AR
  586.      America/Catamarca                  AR
  587.      America/Cordoba                    AR
  588.      America/Jujuy                      AR
  589.      America/Mendoza                    AR
  590.      America/Rosario                    AR
  591.      Pacific/Pago_Pago                  AS
  592.      Europe/Vienna                      AT
  593.      Australia/Adelaide                 AU
  594.      Australia/Brisbane                 AU
  595.      Australia/Broken_Hill              AU
  596.      Australia/Darwin                   AU
  597.      Australia/Hobart                   AU
  598.      Australia/Lindeman                 AU
  599.      Australia/Lord_Howe                AU
  600.      Australia/Melbourne                AU
  601.      Australia/Perth                    AU
  602.      Australia/Sydney                   AU
  603.      America/Aruba                      AW
  604.      Asia/Baku                          AZ
  605.      Europe/Sarajevo                    BA
  606.      America/Barbados                   BB
  607.      Asia/Dacca                         BD
  608.      Europe/Brussels                    BE
  609.      Africa/Ouagadougou                 BF
  610.      Europe/Sofia                       BG
  611.      Asia/Bahrain                       BH
  612.  
  613.  
  614.  
  615. Newman                                                         [Page 11]
  616.  
  617. Internet Draft               Date and Time                  January 1997
  618.  
  619.  
  620.      Africa/Bujumbura                   BI
  621.      Africa/Porto-Novo                  BJ
  622.      Atlantic/Bermuda                   BM
  623.      Asia/Brunei                        BN
  624.      America/La_Paz                     BO
  625.      America/Cuiaba                     BR
  626.      America/Fortaleza                  BR
  627.      America/Maceio                     BR
  628.      America/Manaus                     BR
  629.      America/Noronha                    BR
  630.      America/Porto_Acre                 BR
  631.      America/Sao_Paulo                  BR
  632.      America/Nassau                     BS
  633.      Asia/Thimbu                        BT
  634.      Africa/Gaborone                    BW
  635.      Europe/Minsk                       BY
  636.      America/Belize                     BZ
  637.      America/Dawson                     CA
  638.      America/Dawson_Creek               CA
  639.      America/Edmonton                   CA
  640.      America/Glace_Bay                  CA
  641.      America/Goose_Bay                  CA
  642.      America/Halifax                    CA
  643.      America/Inuvik                     CA
  644.      America/Iqaluit                    CA
  645.      America/Montreal                   CA
  646.      America/Nipigon                    CA
  647.      America/Pangnirtung                CA
  648.      America/Rainy_River                CA
  649.      America/Rankin_Inlet               CA
  650.      America/Regina                     CA
  651.      America/St_Johns                   CA
  652.      America/Swift_Current              CA
  653.      America/Thunder_Bay                CA
  654.      America/Vancouver                  CA
  655.      America/Whitehorse                 CA
  656.      America/Winnipeg                   CA
  657.      America/Yellowknife                CA
  658.      Indian/Cocos                       CC
  659.      Africa/Bangui                      CF
  660.      Africa/Brazzaville                 CG
  661.      Europe/Zurich                      CH
  662.      Africa/Abidjan                     CI
  663.      Pacific/Rarotonga                  CK
  664.      America/Santiago                   CL
  665.      Pacific/Easter                     CL
  666.      Africa/Douala                      CM
  667.      Asia/Chungking                     CN
  668.  
  669.  
  670.  
  671. Newman                                                         [Page 12]
  672.  
  673. Internet Draft               Date and Time                  January 1997
  674.  
  675.  
  676.      Asia/Harbin                        CN
  677.      Asia/Kashgar                       CN
  678.      Asia/Shanghai                      CN
  679.      Asia/Urumqi                        CN
  680.      America/Bogota                     CO
  681.      America/Costa_Rica                 CR
  682.      America/Havana                     CU
  683.      Atlantic/Cape_Verde                CV
  684.      Indian/Christmas                   CX
  685.      Asia/Nicosia                       CY
  686.      Europe/Prague                      CZ
  687.      Europe/Berlin                      DE
  688.      Africa/Djibouti                    DJ
  689.      Europe/Copenhagen                  DK
  690.      America/Dominica                   DM
  691.      America/Santo_Domingo              DO
  692.      Africa/Algiers                     DZ
  693.      America/Guayaquil                  EC
  694.      Pacific/Galapagos                  EC
  695.      Europe/Tallinn                     EE
  696.      Africa/Cairo                       EG
  697.      Africa/El_Aaiun                    EH
  698.      Africa/Asmera                      ER
  699.      Africa/Ceuta                       ES
  700.      Atlantic/Canary                    ES
  701.      Europe/Madrid                      ES
  702.      Africa/Addis_Ababa                 ET
  703.      Europe/Helsinki                    FI
  704.      Pacific/Fiji                       FJ
  705.      Atlantic/Stanley                   FK
  706.      Pacific/Kosrae                     FM
  707.      Pacific/Ponape                     FM
  708.      Pacific/Truk                       FM
  709.      Pacific/Yap                        FM
  710.      Atlantic/Faeroe                    FO
  711.      Europe/Paris                       FR
  712.      Africa/Libreville                  GA
  713.      Europe/Belfast                     GB
  714.      Europe/London                      GB
  715.      America/Grenada                    GD
  716.      Asia/Tbilisi                       GE
  717.      America/Cayenne                    GF
  718.      Africa/Accra                       GH
  719.      Europe/Gibraltar                   GI
  720.      America/Godthab                    GL
  721.      America/Scoresbysund               GL
  722.      America/Thule                      GL
  723.      Africa/Banjul                      GM
  724.  
  725.  
  726.  
  727. Newman                                                         [Page 13]
  728.  
  729. Internet Draft               Date and Time                  January 1997
  730.  
  731.  
  732.      Africa/Conakry                     GN
  733.      America/Guadeloupe                 GP
  734.      Africa/Malabo                      GQ
  735.      Europe/Athens                      GR
  736.      Atlantic/South_Georgia             GS
  737.      America/Guatemala                  GT
  738.      Pacific/Guam                       GU
  739.      Africa/Bissau                      GW
  740.      America/Guyana                     GY
  741.      Asia/Hong_Kong                     HK
  742.      America/Tegucigalpa                HN
  743.      Europe/Zagreb                      HR
  744.      America/Port-au-Prince             HT
  745.      Europe/Budapest                    HU
  746.      Asia/Jakarta                       ID
  747.      Asia/Jayapura                      ID
  748.      Asia/Ujung_Pandang                 ID
  749.      Europe/Dublin                      IE
  750.      Asia/Gaza                          IL
  751.      Asia/Jerusalem                     IL
  752.      Asia/Calcutta                      IN
  753.      Indian/Chagos                      IO
  754.      Asia/Baghdad                       IQ
  755.      Asia/Tehran                        IR
  756.      Atlantic/Reykjavik                 IS
  757.      Europe/Rome                        IT
  758.      America/Jamaica                    JM
  759.      Asia/Amman                         JO
  760.      Asia/Ishigaki                      JP
  761.      Asia/Tokyo                         JP
  762.      Africa/Nairobi                     KE
  763.      Asia/Bishkek                       KG
  764.      Asia/Phnom_Penh                    KH
  765.      Pacific/Enderbury                  KI
  766.      Pacific/Kiritimati                 KI
  767.      Pacific/Tarawa                     KI
  768.      Indian/Comoro                      KM
  769.      America/St_Kitts                   KN
  770.      Asia/Pyongyang                     KP
  771.      Asia/Seoul                         KR
  772.      Asia/Kuwait                        KW
  773.      America/Cayman                     KY
  774.      Asia/Alma-Ata                      KZ
  775.      Asia/Aqtau                         KZ
  776.      Asia/Aqtobe                        KZ
  777.      Asia/Vientiane                     LA
  778.      Asia/Beirut                        LB
  779.      America/St_Lucia                   LC
  780.  
  781.  
  782.  
  783. Newman                                                         [Page 14]
  784.  
  785. Internet Draft               Date and Time                  January 1997
  786.  
  787.  
  788.      Europe/Vaduz                       LI
  789.      Asia/Colombo                       LK
  790.      Africa/Monrovia                    LR
  791.      Africa/Maseru                      LS
  792.      Europe/Vilnius                     LT
  793.      Europe/Luxembourg                  LU
  794.      Europe/Riga                        LV
  795.      Africa/Tripoli                     LY
  796.      Africa/Casablanca                  MA
  797.      Europe/Monaco                      MC
  798.      Europe/Chisinau                    MD
  799.      Indian/Antananarivo                MG
  800.      Pacific/Kwajalein                  MH
  801.      Pacific/Majuro                     MH
  802.      Europe/Skopje                      MK
  803.      Africa/Bamako                      ML
  804.      Africa/Timbuktu                    ML
  805.      Asia/Rangoon                       MM
  806.      Asia/Ulan_Bator                    MN
  807.      Asia/Macao                         MO
  808.      Pacific/Saipan                     MP
  809.      America/Martinique                 MQ
  810.      Africa/Nouakchott                  MR
  811.      America/Montserrat                 MS
  812.      Europe/Malta                       MT
  813.      Indian/Mauritius                   MU
  814.      Indian/Maldives                    MV
  815.      Africa/Blantyre                    MW
  816.      America/Ensenada                   MX
  817.      America/Mazatlan                   MX
  818.      America/Mexico_City                MX
  819.      America/Tijuana                    MX
  820.      Asia/Kuala_Lumpur                  MY
  821.      Asia/Kuching                       MY
  822.      Africa/Maputo                      MZ
  823.      Africa/Windhoek                    NA
  824.      Pacific/Noumea                     NC
  825.      Africa/Niamey                      NE
  826.      Pacific/Norfolk                    NF
  827.      Africa/Lagos                       NG
  828.      America/Managua                    NI
  829.      Europe/Amsterdam                   NL
  830.      Europe/Oslo                        NO
  831.      Asia/Katmandu                      NP
  832.      Pacific/Nauru                      NR
  833.      Pacific/Niue                       NU
  834.      Pacific/Auckland                   NZ
  835.      Pacific/Chatham                    NZ
  836.  
  837.  
  838.  
  839. Newman                                                         [Page 15]
  840.  
  841. Internet Draft               Date and Time                  January 1997
  842.  
  843.  
  844.      Asia/Muscat                        OM
  845.      America/Panama                     PA
  846.      America/Lima                       PE
  847.      Pacific/Gambier                    PF
  848.      Pacific/Marquesas                  PF
  849.      Pacific/Tahiti                     PF
  850.      Pacific/Port_Moresby               PG
  851.      Asia/Manila                        PH
  852.      Asia/Karachi                       PK
  853.      Europe/Warsaw                      PL
  854.      America/Miquelon                   PM
  855.      Pacific/Pitcairn                   PN
  856.      America/Puerto_Rico                PR
  857.      Atlantic/Azores                    PT
  858.      Atlantic/Madeira                   PT
  859.      Europe/Lisbon                      PT
  860.      Pacific/Palau                      PW
  861.      America/Asuncion                   PY
  862.      Asia/Qatar                         QA
  863.      Indian/Reunion                     RE
  864.      Europe/Bucharest                   RO
  865.      Asia/Anadyr                        RU
  866.      Asia/Irkutsk                       RU
  867.      Asia/Kamchatka                     RU
  868.      Asia/Krasnoyarsk                   RU
  869.      Asia/Magadan                       RU
  870.      Asia/Novosibirsk                   RU
  871.      Asia/Omsk                          RU
  872.      Asia/Vladivostok                   RU
  873.      Asia/Yakutsk                       RU
  874.      Asia/Yekaterinburg                 RU
  875.      Europe/Kaliningrad                 RU
  876.      Europe/Moscow                      RU
  877.      Europe/Samara                      RU
  878.      Africa/Kigali                      RW
  879.      Asia/Riyadh                        SA
  880.      Pacific/Guadalcanal                SB
  881.      Indian/Mahe                        SC
  882.      Africa/Khartoum                    SD
  883.      Europe/Stockholm                   SE
  884.      Asia/Singapore                     SG
  885.      Atlantic/St_Helena                 SH
  886.      Europe/Ljubljana                   SI
  887.      Arctic/Longyearbyen                SJ
  888.      Atlantic/Jan_Mayen                 SJ
  889.      Europe/Bratislava                  SK
  890.      Africa/Freetown                    SL
  891.      Europe/San_Marino                  SM
  892.  
  893.  
  894.  
  895. Newman                                                         [Page 16]
  896.  
  897. Internet Draft               Date and Time                  January 1997
  898.  
  899.  
  900.      Africa/Dakar                       SN
  901.      Africa/Mogadishu                   SO
  902.      America/Paramaribo                 SR
  903.      Africa/Sao_Tome                    ST
  904.      America/El_Salvador                SV
  905.      Asia/Damascus                      SY
  906.      Africa/Mbabane                     SZ
  907.      America/Grand_Turk                 TC
  908.      Africa/Ndjamena                    TD
  909.      Indian/Kerguelen                   TF
  910.      Africa/Lome                        TG
  911.      Asia/Bangkok                       TH
  912.      Asia/Dushanbe                      TJ
  913.      Pacific/Fakaofo                    TK
  914.      Asia/Ashkhabad                     TM
  915.      Africa/Tunis                       TN
  916.      Pacific/Tongatapu                  TO
  917.      Europe/Istanbul                    TR
  918.      America/Port_of_Spain              TT
  919.      Pacific/Funafuti                   TV
  920.      Asia/Taipei                        TW
  921.      Africa/Dar_es_Salaam               TZ
  922.      Europe/Kiev                        UA
  923.      Europe/Simferopol                  UA
  924.      Africa/Kampala                     UG
  925.      Pacific/Johnston                   UM
  926.      Pacific/Midway                     UM
  927.      Pacific/Wake                       UM
  928.      America/Adak                       US
  929.      America/Anchorage                  US
  930.      America/Boise                      US
  931.      America/Chicago                    US
  932.      America/Denver                     US
  933.      America/Detroit                    US
  934.      America/Indianapolis               US
  935.      America/Juneau                     US
  936.      America/Los_Angeles                US
  937.      America/Louisville                 US
  938.      America/Menominee                  US
  939.      America/New_York                   US
  940.      America/Nome                       US
  941.      America/Phoenix                    US
  942.      America/Shiprock                   US
  943.      America/Yakutat                    US
  944.      Pacific/Honolulu                   US
  945.      America/Montevideo                 UY
  946.      Asia/Tashkent                      UZ
  947.      Europe/Vatican                     VA
  948.  
  949.  
  950.  
  951. Newman                                                         [Page 17]
  952.  
  953. Internet Draft               Date and Time                  January 1997
  954.  
  955.  
  956.      America/St_Vincent                 VC
  957.      America/Caracas                    VE
  958.      America/Tortola                    VG
  959.      America/St_Thomas                  VI
  960.      Asia/Saigon                        VN
  961.      Pacific/Efate                      VU
  962.      Pacific/Wallis                     WF
  963.      Pacific/Apia                       WS
  964.      Asia/Aden                          YE
  965.      Indian/Mayotte                     YT
  966.      Europe/Belgrade                    YU
  967.      Africa/Johannesburg                ZA
  968.      Africa/Lusaka                      ZM
  969.      Africa/Kinshasa                    ZR
  970.      Africa/Lubumbashi                  ZR
  971.      Africa/Harare                      ZW
  972.  
  973.  
  974. 6.7. Local Date/Time Format
  975.  
  976.      The following format MAY be used to refer to future dates in a
  977.      local timezone.  This is defined based on the format in section
  978.      5.6.
  979.  
  980.      zone-char = ALPHA / DIGIT / "-" / "_" / "/"
  981.      zone-name = 1*zone_char
  982.                     ; case insensitive interpretation
  983.      offset-hint = time-numoffset
  984.  
  985.      local-datetime = full-date "T" partial-time " " zone-name
  986.                       [" " offset-hint]
  987.  
  988.      A local-datetime represents an event relative to a specific local
  989.      timezone.  The offset-hint represents the generator's prediction of
  990.      what the UTC offset will be at that local time, and may become
  991.      incorrect if the rules for the specified zone are changed.  The
  992.      offset-hint MAY be omitted if the generating program only knows
  993.      local time, but the zone-name is REQUIRED.  This format SHOULD NOT
  994.      be used for timestamps or past events.
  995.  
  996.  
  997. 6.8. Examples
  998.  
  999.      Here are some examples of Local Date/Time Format:
  1000.  
  1001.      1999-12-31T23:59:59 America/New_York -05:00
  1002.  
  1003.      This represents a time one (or two if there's a leap second) second
  1004.  
  1005.  
  1006.  
  1007. Newman                                                         [Page 18]
  1008.  
  1009. Internet Draft               Date and Time                  January 1997
  1010.  
  1011.  
  1012.      before the year 2000 in the timezone used in New York City in North
  1013.      America (currently U.S. Eastern Time).  The offset-hint is the
  1014.      number to add to the local time to get an estimate UTC for that
  1015.      date, so this will probably be equivalent to 2000-01-01T04:59:59Z.
  1016.  
  1017.      2000-12-31T23:59:59 Australia/Adelaide +09:30
  1018.  
  1019.      This represents a time one (or two if there's a leap second) second
  1020.      before the 21st century in Adelaide, Australia.  The hint suggests
  1021.      that this will be equivalent to 2000-12-31T14:29:59Z.
  1022.  
  1023.      2000-03-31T02:00:00 America/Los_Angeles -08:00
  1024.  
  1025.      The represents a time of the 2nd hour on the 31st of March in Los
  1026.      Angeles, USA.  The hint suggests that would be equivalent to 2000-
  1027.      03-31T10:00:00Z.  However, if the U.S. government were to adopt the
  1028.      daylight savings rules currently used by the European Union, which
  1029.      change daylight savings on the last Sunday of March, then the time
  1030.      would be equivalent to 2000-03-31T09:00:00Z.
  1031.  
  1032.  
  1033. 7. Acknowledgements
  1034.  
  1035.      May thanks to the following people who have provided helpful advice
  1036.      for this document: Ned Freed, Neal McBurnett, David Keegel, Markus
  1037.      Kuhn, Paul Eggert and Robert Elz.  Thanks are also due to
  1038.      participants of the IETF Calendaring/Scheduling working group
  1039.      mailing list, and participants of the timezone mailing list.
  1040.  
  1041.  
  1042. 8. References
  1043.  
  1044. [Zeller] Chr. Zeller, "Kalender-Formeln", Acta Mathematica, Vol. 9,
  1045.  Nov 1886.
  1046.  
  1047. [IMAIL] Crocker, D., "Standard for the Format of Arpa Internet Text
  1048.  Messages", RFC 822, University of Delaware, August 1982.
  1049.  
  1050.     <ftp://ds.internic.net/rfc/rfc822.txt>
  1051.  
  1052. [ISO8601] "Data elements and interchange formats -- Information
  1053.  interchange -- Representation of dates and times", ISO 8601:1988(E),
  1054.  International Organization for Standardization, June, 1988.
  1055.  
  1056. [HOST-REQ] Braden, R., "Requirements for Internet Hosts -- Application
  1057.  and Support", RFC 1123, Internet Engineering Task Force, October 1989.
  1058.  
  1059.     <ftp://ds.internic.net/rfc/rfc1123.txt>
  1060.  
  1061.  
  1062.  
  1063. Newman                                                         [Page 19]
  1064.  
  1065. Internet Draft               Date and Time                  January 1997
  1066.  
  1067.  
  1068. [NTP] Mills, D., "Network Time Protocol (Version 3) Specification,
  1069.  Implementation and Analysis", RFC 1305, University of Delaware, March
  1070.  1992.
  1071.  
  1072.     <ftp://ds.internic.net/rfc/rfc1305.tar.Z>
  1073.     <ftp://ds.internic.net/rfc/rfc1305.txt>
  1074.  
  1075. [ITU-R-TF] International Telecommunication Union Recommendations for
  1076.  Time Signals and Frequency Standards Emissions.
  1077.  
  1078.     <http://www.itu.ch/publications/itu-r/iturtf.htm>
  1079.  
  1080.  
  1081. 9. Security Considerations
  1082.  
  1083.      Since the local time zone of a site may be useful for determining a
  1084.      time when systems are less likely to be monitored and might be more
  1085.      susceptible to a security probe, some sites may wish to emit times
  1086.      in UTC only.  Others might consider this to be loss of useful
  1087.      functionality at the hands of paranoia.
  1088.  
  1089.  
  1090. 10. Author's Address
  1091.  
  1092. Chris Newman
  1093. Innosoft International, Inc.
  1094. 1050 East Garvey Ave. South
  1095. West Covina, CA 91790 USA
  1096.  
  1097. Email: chris.newman@innosoft.com
  1098.  
  1099. APPENDIX
  1100.  
  1101. A. ISO 8601 Collected ABNF
  1102.  
  1103.      ISO 8601 does not specify a formal grammar for the date and time
  1104.      formats it defines.  The following is an attempt to create a formal
  1105.      grammar from ISO 8601.  This is informational only and may contain
  1106.      errors.  ISO 8601 remains the authoratative reference.
  1107.  
  1108.      Note that due to ambiguities in ISO 8601, some interpretations had
  1109.      to be made.  First, ISO 8601 is not clear if mixtures of basic and
  1110.      extended format are permissible.  This grammar permits mixtures.
  1111.      ISO 8601 is not clear on whether an hour of 24 is permissible only
  1112.      if minutes and seconds are 0.  This assumes that an hour of 24 is
  1113.      permissible in any context.  Restrictions on date-mday in section
  1114.      5.7 apply.  ISO 8601 states that the "T" may be omitted under some
  1115.      circumstances.  This grammar requires the "T" to avoid ambiguity.
  1116.  
  1117.  
  1118.  
  1119. Newman                                                         [Page 20]
  1120.  
  1121. Internet Draft               Date and Time                  January 1997
  1122.  
  1123.  
  1124.      ISO 8601 also requires (in section 5.3.1.3) that a decimal fraction
  1125.      be proceeded by a "0" if less than unity.  Annex B.2 of ISO 8601
  1126.      gives examples where the decimal fractions are not preceeded by a
  1127.      "0".  This grammar assumes section 5.3.1.3 is correct and that
  1128.      Annex B.2 is in error.
  1129.  
  1130.      date-century    = 2DIGIT  ; 00-99
  1131.      date-decade     =  DIGIT  ; 0-9
  1132.      date-subdecade  =  DIGIT  ; 0-9
  1133.      date-year       = date-decade date-subdecade
  1134.      date-fullyear   = date-century date-year
  1135.      date-month      = 2DIGIT  ; 01-12
  1136.      date-wday       =  DIGIT  ; 1-7  ; 1 is Monday, 7 is Sunday
  1137.      date-mday       = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on month/year
  1138.      date-yday       = 3DIGIT  ; 001-365, 001-366 based on year
  1139.      date-week       = 2DIGIT  ; 01-52, 01-53 based on year
  1140.  
  1141.      datepart-fullyear = [date-century] date-year ["-"]
  1142.      datepart-ptyear   = "-" [date-subdecade ["-"]]
  1143.      datepart-wkyear   = datepart-ptyear / datepart-fullyear
  1144.  
  1145.      dateopt-century   = "-" / date-century
  1146.      dateopt-fullyear  = "-" / datepart-fullyear
  1147.      dateopt-year      = "-" / (date-year ["-"])
  1148.      dateopt-month     = "-" / (date-month ["-"])
  1149.      dateopt-week      = "-" / (date-week ["-"])
  1150.  
  1151.      datespec-full     = datepart-fullyear date-month ["-"] date-mday
  1152.      datespec-year     = date-century / dateopt-century date-year
  1153.      datespec-month    = "-" dateopt-year date-month [["-"] date-mday]
  1154.      datespec-mday     = "--" dateopt-month date-mday
  1155.      datespec-week     = datepart-wkyear "W"
  1156.                          (date-week / dateopt-week date-wday)
  1157.      datespec-wday     = "---" date-wday
  1158.      datespec-yday     = dateopt-fullyear date-yday
  1159.  
  1160.      date              = datespec-full / datespec-year / datespec-month /
  1161.          datespec-mday / datespec-week / datespec-wday / datespec-yday
  1162.  
  1163.      Time:
  1164.  
  1165.      time-hour         = 2DIGIT ; 00-24
  1166.      time-minute       = 2DIGIT ; 00-59
  1167.      time-second       = 2DIGIT ; 00-59, 00-60 based on leap-second rules
  1168.      time-fraction     = ("," / ".") 1*DIGIT
  1169.      time-numoffset    = ("+" / "-") time-hour [[":"] time-minute]
  1170.      time-zone         = "Z" / time-numoffset
  1171.  
  1172.  
  1173.  
  1174.  
  1175. Newman                                                         [Page 21]
  1176.  
  1177. Internet Draft               Date and Time                  January 1997
  1178.  
  1179.  
  1180.      timeopt-hour      = "-" / (time-hour [":"])
  1181.      timeopt-minute    = "-" / (time-minute [":"])
  1182.  
  1183.      timespec-hour     = time-hour [[":"] time-minute [[":"] time-second]]
  1184.      timespec-minute   = timeopt-hour time-minute [[":"] time-second]
  1185.      timespec-second   = "-" timeopt-minute time-second
  1186.      timespec-base     = timespec-hour / timespec-minute / timespec-second
  1187.  
  1188.      time              = timespec-base [time-fraction] [time-zone]
  1189.  
  1190.      iso-date-time     = date "T" time
  1191.  
  1192.      Durations (periods):
  1193.  
  1194.      dur-second        = 1*DIGIT "S"
  1195.      dur-minute        = 1*DIGIT "M" [dur-second]
  1196.      dur-hour          = 1*DIGIT "H" [dur-minute]
  1197.      dur-time          = "T" (dur-hour / dur-minute / dur-second)
  1198.      dur-day           = 1*DIGIT "D"
  1199.      dur-week          = 1*DIGIT "W"
  1200.      dur-month         = 1*DIGIT "M" [dur-day]
  1201.      dur-year          = 1*DIGIT "Y" [dur-month]
  1202.      dur-date          = (dur-day / dur-month / dur-year) [dur-time]
  1203.  
  1204.      duration          = "P" (dur-date / dur-time / dur-week)
  1205.  
  1206.      Periods:
  1207.  
  1208.      period-explicit   = date-time "/" date-time
  1209.      period-start      = date-time "/" duration
  1210.      period-end        = duration "/" date-time
  1211.  
  1212.      period            = period-explicit / period-start / period-end
  1213.  
  1214.  
  1215. B. Day of the Week
  1216.  
  1217.      The following is a sample C subroutine loosly based on Zeller's
  1218.      Congruence [Zeller] which may be used to obtain the day of the
  1219.      week:
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231. Newman                                                         [Page 22]
  1232.  
  1233. Internet Draft               Date and Time                  January 1997
  1234.  
  1235.  
  1236.      char *day_of_week(int day, int month, int year)
  1237.      {
  1238.          char *dayofweek[] = {
  1239.              "Sunday", "Monday", "Tuesday", "Wednesday",
  1240.              "Thursday", "Friday", "Saturday"
  1241.          };
  1242.  
  1243.          /* adjust months so February is the last one */
  1244.          month -= 2;
  1245.          if (month < 1) {
  1246.              month += 12;
  1247.              --year;
  1248.          }
  1249.          /* split by century */
  1250.          cent = year / 100;
  1251.          year %= 100;
  1252.          return (dayofweek[((26 * month - 2) / 10 + day + year
  1253.                            + year / 4 + cent / 4 - 2 * cent) % 7]);
  1254.      }
  1255.  
  1256.  
  1257. C. Leap Years
  1258.  
  1259.      Here's a sample C subroutine to calculate if a year is a leap year:
  1260.  
  1261.      /* This returns non-zero if year is a leap year.  Must use 4 digit year.
  1262.       */
  1263.      int leap_year(int year)
  1264.      {
  1265.          return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
  1266.      }
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287. Newman                                                         [Page 23]
  1288.  
  1289.