Home | History | Annotate | Line # | Download | only in time
tz-how-to.html revision 1.8
      1 <!DOCTYPE html>
      2 <html lang="en">
      3 <head>
      4 <title>How to Read the tz Database</title>
      5 <meta charset="UTF-8">
      6 <style>
      7 pre {margin-left: 2em; white-space: pre-wrap;}
      8 pre.td {margin-left: 0;}
      9 td {text-align: center;}
     10 table {border: 1px outset;}
     11 th, td {border: 1px inset;}
     12 table.rule {border: none; margin: auto;}
     13 td.footnote {text-align: left;}
     14 </style>
     15 </head>
     16 <body>
     17 <h2>How to Read the <a href="https://en.wikipedia.org/wiki/Tz_database">tz
     18 Database</a> Source Files</h2>
     19 <h3>by Bill Seymour</h3>
     20 <p>This page uses the <code>America/Chicago</code> and
     21 <code>Pacific/Honolulu</code> zones as examples of how to infer
     22 times of day from the <a href="tz-link.html">tz database</a>
     23 source files. It might be helpful, but not absolutely necessary,
     24 for the reader to have already downloaded the
     25 latest release of the database and become familiar with the basic layout
     26 of the data files. The format is explained in the &ldquo;man
     27 page&rdquo; for the zic compiler, <code>zic.8.txt</code>, in
     28 the <code>code</code> subdirectory.</p>
     29 
     30 <p>We&rsquo;ll begin by talking about the rules for changing between standard
     31 and daylight saving time since we&rsquo;ll need that information when we talk
     32 about the zones.</p>
     33 
     34 <p>First, let&rsquo;s consider the special daylight saving time rules
     35 for Chicago (from the <code>northamerica</code> file in
     36 the <code>data</code> subdirectory):</p>
     37 
     38 <table>
     39 <tr>
     40   <th colspan="6">From the Source File</th>
     41 </tr>
     42 <tr>
     43   <td colspan="6">
     44     <table class="rule">
     45       <tr><td style="border:none;text-align:left">
     46 <pre class="td">
     47 #Rule NAME    FROM TO    -   IN  ON      AT   SAVE LETTER
     48 Rule  Chicago 1920 only  -   Jun 13      2:00 1:00 D
     49 Rule  Chicago 1920 1921  -   Oct lastSun 2:00 0    S
     50 Rule  Chicago 1921 only  -   Mar lastSun 2:00 1:00 D
     51 Rule  Chicago 1922 1966  -   Apr lastSun 2:00 1:00 D
     52 Rule  Chicago 1922 1954  -   Sep lastSun 2:00 0    S
     53 Rule  Chicago 1955 1966  -   Oct lastSun 2:00 0    S
     54 </pre>
     55   </td></tr></table></td>
     56 </tr>
     57 <tr>
     58   <th colspan="6">Reformatted a Bit</th>
     59 </tr>
     60 <tr>
     61   <th>From</th>
     62   <th>To</th>
     63   <th colspan="2">On</th>
     64   <th>At</th>
     65   <th>Action</th>
     66 </tr>
     67 <tr>
     68   <td colspan="2">1920 only</td>
     69   <td colspan="2">June 13<small><sup>th</sup></small></td>
     70   <td rowspan="6">02:00 local</td>
     71   <td>go to daylight saving time</td>
     72 </tr>
     73 <tr>
     74   <td>1920</td>
     75   <td>1921</td>
     76   <td rowspan="5">last Sunday</td>
     77   <td>in October</td>
     78   <td>return to standard time</td>
     79 </tr>
     80 <tr>
     81   <td colspan="2">1921 only</td>
     82   <td>in March</td>
     83   <td rowspan="2">go to daylight saving time</td>
     84 </tr>
     85 <tr>
     86   <td rowspan="2">1922</td>
     87   <td>1966</td>
     88   <td>in April</td>
     89 </tr>
     90 <tr>
     91   <td>1954</td>
     92   <td>in September</td>
     93   <td rowspan="2">return to standard time</td>
     94 </tr>
     95 <tr>
     96   <td>1955</td>
     97   <td>1966</td>
     98   <td>in October</td>
     99 </tr>
    100 </table>
    101 
    102 <p>The <code>FROM</code> and <code>TO</code> columns, respectively, specify the
    103 first and last calendar years defining a contiguous range over which a specific
    104 Rule line is to apply.  The keyword <code>only</code> can be used in the
    105 <code>TO</code> field to repeat the value of the <code>FROM</code> field in the
    106 event that a rule should only apply to a single year.  Often, the keyword
    107 <code>max</code> is used to extend a rule&rsquo;s application into the
    108 indefinite future; it is a platform-agnostic stand-in for the largest
    109 representable year.
    110 
    111 <p>The next column, <code>-</code>, is reserved; for compatibility with earlier
    112 releases, it always contains a hyphen, which acts as a kind of null value.
    113 Prior to the 2020b release, it was called the <code>TYPE</code> field, though
    114 it was never used in the main data.  An obsolescent supplementary file used the
    115 field as a proof-of-concept to allow <code>zic</code> to apply a given Rule
    116 line only to certain &ldquo;types&rdquo; of years within the specified range as
    117 dictated by the output of a separate script, such as: only years which would
    118 have a US presidential election, or only years which wouldn&rsquo;t.
    119 
    120 <p>The <code>SAVE</code> column contains the local (wall clock) offset from
    121 local standard time.
    122 This is usually either zero for standard time or one hour for daylight
    123 saving time; but there&rsquo;s no reason, in principle, why it can&rsquo;t
    124 take on other values.
    125 
    126 <p>The <code>LETTER</code> (sometimes called <code>LETTER/S</code>)
    127 column can contain a variable
    128 part of the usual abbreviation of the time zone&rsquo;s name, or it can just
    129 be a hyphen if there&rsquo;s no variable part. For example, the abbreviation
    130 used in the central time zone will be either &ldquo;CST&rdquo; or
    131 &ldquo;CDT&rdquo;. The variable part is &lsquo;S&rsquo; or &lsquo;D&rsquo;;
    132 and, sure enough, that&rsquo;s just what we find in
    133 the <code>LETTER</code> column
    134 in the <code>Chicago</code> rules. More about this when we talk about
    135 &ldquo;Zone&rdquo; lines.
    136 
    137 <p>One important thing to notice is that &ldquo;Rule&rdquo; lines
    138 want at once to be both <i>transitions</i> and <i>steady states</i>:
    139 <ul>
    140 <li>On the one hand, they represent transitions between standard and
    141 daylight saving time; and any number of Rule lines can be in effect
    142 during a given period (which will always be a non-empty set of
    143 contiguous calendar years).</li>
    144 <li>On the other hand, the <code>SAVE</code> and <code>LETTER</code>
    145 columns contain state that exists between transitions. More about this
    146 when we talk about the US rules.</li>
    147 </ul>
    148 
    149 <p>In the example above, the transition to daylight saving time
    150 happened on the 13<small><sup>th</sup></small> of June in 1920, and on
    151 the last Sunday in March in 1921; but the return to standard time
    152 happened on the last Sunday in October in both of those
    153 years. Similarly, the rule for changing to daylight saving time was
    154 the same from 1922 to 1966; but the rule for returning to standard
    155 time changed in 1955. Got it?</p>
    156 
    157 <p>OK, now for the somewhat more interesting &ldquo;US&rdquo; rules:</p>
    158 
    159 <table>
    160 <tr>
    161   <th colspan="6">From the Source File</th>
    162 </tr>
    163 <tr>
    164   <td colspan="6">
    165     <table class="rule">
    166       <tr><td style="border:none;text-align:left">
    167 <pre class="td">
    168 #Rule NAME FROM TO    -   IN  ON        AT   SAVE LETTER/S
    169 Rule  US   1918 1919  -   Mar lastSun  2:00  1:00 D
    170 Rule  US   1918 1919  -   Oct lastSun  2:00  0    S
    171 Rule  US   1942 only  -   Feb 9        2:00  1:00 W # War
    172 Rule  US   1945 only  -   Aug 14      23:00u 1:00 P # Peace
    173 Rule  US   1945 only  -   Sep 30       2:00  0    S
    174 Rule  US   1967 2006  -   Oct lastSun  2:00  0    S
    175 Rule  US   1967 1973  -   Apr lastSun  2:00  1:00 D
    176 Rule  US   1974 only  -   Jan 6        2:00  1:00 D
    177 Rule  US   1975 only  -   Feb 23       2:00  1:00 D
    178 Rule  US   1976 1986  -   Apr lastSun  2:00  1:00 D
    179 Rule  US   1987 2006  -   Apr Sun&gt;=1   2:00  1:00 D
    180 Rule  US   2007 max   -   Mar Sun&gt;=8   2:00  1:00 D
    181 Rule  US   2007 max   -   Nov Sun&gt;=1   2:00  0    S
    182 </pre>
    183   </td></tr></table></td>
    184 </tr>
    185 <tr>
    186   <th colspan="6">Reformatted a Bit</th>
    187 </tr>
    188 <tr>
    189   <th>From</th>
    190   <th>To</th>
    191   <th colspan="2">On</th>
    192   <th>At</th>
    193   <th>Action</th>
    194 </tr>
    195 <tr>
    196   <td rowspan="2">1918</td>
    197   <td rowspan="2">1919</td>
    198   <td rowspan="2">last Sunday</td>
    199   <td>in March</td>
    200   <td rowspan="3">02:00 local</td>
    201   <td>go to daylight saving time</td>
    202 </tr>
    203 <tr>
    204   <td>in October</td>
    205   <td>return to standard time</td>
    206 </tr>
    207 <tr>
    208   <td colspan="2">1942 only</td>
    209   <td colspan="2">February 9<small><sup>th</sup></small></td>
    210   <td>go to &ldquo;war time&rdquo;</td>
    211 </tr>
    212 <tr>
    213   <td colspan="2" rowspan="2">1945 only</td>
    214   <td colspan="2">August 14<small><sup>th</sup></small></td>
    215   <td>23:00 <a href="https://en.wikipedia.org/wiki/Universal_Time">UT</a></td>
    216   <td>
    217     rename &ldquo;war time&rdquo; to &ldquo;peace<br>time;&rdquo;
    218     clocks don&rsquo;t change
    219   </td>
    220 </tr>
    221 <tr>
    222   <td colspan="2">September 30<small><sup>th</sup></small></td>
    223   <td rowspan="9">02:00 local</td>
    224   <td rowspan="2">return to standard time</td>
    225 </tr>
    226 <tr>
    227   <td rowspan="2">1967</td>
    228   <td>2006</td>
    229   <td rowspan="2">last Sunday</td>
    230   <td>in October</td>
    231 </tr>
    232 <tr>
    233   <td>1973</td>
    234   <td>in April</td>
    235   <td rowspan="6">go to daylight saving time</td>
    236 </tr>
    237 <tr>
    238   <td colspan="2">1974 only</td>
    239   <td colspan="2">January 6<small><sup>th</sup></small></td>
    240 </tr>
    241 <tr>
    242   <td colspan="2">1975 only</td>
    243   <td colspan="2">February 23<small><sup>rd</sup></small></td>
    244 </tr>
    245 <tr>
    246   <td>1976</td>
    247   <td>1986</td>
    248   <td>last Sunday</td>
    249   <td rowspan="2">in April</td>
    250 </tr>
    251 <tr>
    252   <td>1987</td>
    253   <td>2006</td>
    254   <td>first Sunday</td>
    255 </tr>
    256 <tr>
    257   <td rowspan="2">2007</td>
    258   <td rowspan="2">present</td>
    259   <td colspan="2">second Sunday in March</td>
    260 </tr>
    261 <tr>
    262   <td colspan="2">first Sunday in November</td>
    263   <td>return to standard time</td>
    264 </tr>
    265 </table>
    266 
    267 <p>There are two interesting things to note here.</p>
    268 
    269 <p>First, the time that something happens (in the <code>AT</code>
    270 column) is not necessarily the local (wall clock) time. The time can be
    271 suffixed with &lsquo;s&rsquo; (for &ldquo;standard&rdquo;) to mean
    272 local standard time, different from local (wall clock) time when observing
    273 daylight saving time; or it can be suffixed with &lsquo;g&rsquo;,
    274 &lsquo;u&rsquo;, or &lsquo;z&rsquo;, all three of which mean the
    275 standard time at the
    276 <a href="https://en.wikipedia.org/wiki/Prime_Meridian">prime meridian</a>.
    277 &lsquo;g&rsquo; stands for &ldquo;<a
    278 href="https://en.wikipedia.org/wiki/Greenwich_Mean_Time">GMT</a>&rdquo;;
    279 &lsquo;u&rsquo; stands for &ldquo;<a
    280 href="https://en.wikipedia.org/wiki/Universal_Time">UT</a>&rdquo; or &ldquo;<a
    281 href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time">UTC</a>&rdquo;
    282 (whichever was official at the time); &lsquo;z&rsquo; stands for the
    283 <a href="https://en.wikipedia.org/wiki/Nautical_time">nautical time zone</a>
    284 Z (a.k.a. &ldquo;Zulu&rdquo; which, in turn, stands for &lsquo;Z&rsquo;).
    285 The time can also be suffixed with &lsquo;w&rsquo; meaning local (wall
    286 clock) time; but it usually isn&rsquo;t because that&rsquo;s the
    287 default.</p>
    288 
    289 <p>Second, the day in the <code>ON</code> column, in addition to
    290 &ldquo;<code>lastSun</code>&rdquo; or a particular day of the month,
    291 can have the form, &ldquo;<code>Sun&gt;=</code><i>x</i>&rdquo; or
    292 &ldquo;<code>Sun&lt;=</code><i>x</i>,&rdquo; where <i>x</i> is a day
    293 of the month. For example, &ldquo;<code>Sun&gt;=8</code>&rdquo; means
    294 &ldquo;the first Sunday on or after the eighth of the month,&rdquo; in
    295 other words, the second Sunday of the month. Furthermore, although
    296 there are no examples above, the weekday needn&rsquo;t be
    297 &ldquo;<code>Sun</code>&rdquo; in either form, but can be the usual
    298 three-character English abbreviation for any day of the week.</p>
    299 
    300 <p>And the US rules give us more examples of a couple of things
    301 already mentioned:</p>
    302 
    303 <ul>
    304 <li>The rules for changing to and from daylight saving time are
    305 actually <i>different sets</i> of rules; and the two sets can change
    306 independently. Consider, for example, that the rule for the return to
    307 standard time stayed the same from 1967 to 2006; but the rule for the
    308 transition to daylight saving time changed several times in the same
    309 period.  There can also be periods, 1946 to 1966 for example, when no
    310 rule from this group is in effect, and so either no transition
    311 happened in those years, or some other rule is in effect (perhaps a
    312 state or other more local rule).</li>
    313 
    314 <li>The <code>SAVE</code> and <code>LETTER</code> columns
    315 contain <i>steady state</i>, not transitions. Consider, for example,
    316 the transition from &ldquo;war time&rdquo; to &ldquo;peace time&rdquo;
    317 that happened on August 14, 1945. The &ldquo;1:00&rdquo; in
    318 the <code>SAVE</code> column is <i>not</i> an instruction to advance
    319 the clock an hour. It means that clocks should <i>be</i> one hour
    320 ahead of standard time, which they already are because of the previous
    321 rule, so there should be no change.</li>
    322 
    323 </ul>
    324 
    325 <p>OK, now let&rsquo;s look at a Zone record:</p>
    326 
    327 <table>
    328 <tr>
    329   <th colspan="5">From the Source File</th>
    330 </tr>
    331 <tr>
    332   <td colspan="5">
    333     <table class="rule">
    334       <tr><td style="border:none;text-align:left">
    335 <pre class="td">
    336 #Zone       NAME      STDOFF   RULES FORMAT [UNTIL]
    337 Zone  America/Chicago -5:50:36 -       LMT  1883 Nov 18 12:09:24
    338                       -6:00    US      C%sT 1920
    339                       -6:00    Chicago C%sT 1936 Mar  1  2:00
    340                       -5:00    -       EST  1936 Nov 15  2:00
    341                       -6:00    Chicago C%sT 1942
    342                       -6:00    US      C%sT 1946
    343                       -6:00    Chicago C%sT 1967
    344                       -6:00    US      C%sT
    345 </pre>
    346   </td></tr></table></td>
    347 </tr>
    348 <tr>
    349   <th colspan="5">Columns Renamed</th>
    350 </tr>
    351 <tr>
    352   <th rowspan="2">Standard Offset<br>
    353     from <a href="https://en.wikipedia.org/wiki/Prime_Meridian">Prime
    354     Meridian</a></th>
    355   <th rowspan="2">Daylight<br>Saving Time</th>
    356   <th rowspan="2">Abbreviation(s)</th>
    357   <th colspan="2">Ending at Local Time</th>
    358 </tr>
    359 <tr>
    360   <th>Date</th>
    361   <th>Time</th>
    362 </tr>
    363 <tr>
    364   <td>&minus;5:50:36</td>
    365   <td>not observed</td>
    366   <td>LMT</td>
    367   <td>1883-11-18</td>
    368   <td>12:09:24</td>
    369 </tr>
    370 <tr>
    371   <td rowspan="2">&minus;6:00:00</td>
    372   <td>US rules</td>
    373   <td rowspan="2">CST or CDT</td>
    374   <td>1920-01-01</td>
    375   <td>00:00:00</td>
    376 </tr>
    377 <tr>
    378   <td>Chicago rules</td>
    379   <td>1936-03-01</td>
    380   <td rowspan="2">02:00:00</td>
    381 </tr>
    382 <tr>
    383   <td>&minus;5:00:00</td>
    384   <td>not observed</td>
    385   <td>EST</td>
    386   <td>1936-11-15</td>
    387 </tr>
    388 <tr>
    389   <td rowspan="4">&minus;6:00:00</td>
    390   <td>Chicago rules</td>
    391   <td>CST or CDT</td>
    392   <td>1942-01-01</td>
    393   <td rowspan="3">00:00:00</td>
    394 </tr>
    395 <tr>
    396   <td>US rules</td>
    397   <td>CST, CWT or CPT</td>
    398   <td>1946-01-01</td>
    399 </tr>
    400 <tr>
    401   <td>Chicago rules</td>
    402   <td rowspan="2">CST or CDT</td>
    403   <td>1967-01-01</td>
    404 </tr>
    405 <tr>
    406   <td>US rules</td>
    407   <td colspan="2">&mdash;</td>
    408 </tr>
    409 </table>
    410 
    411 <p>There are a couple of interesting differences between Zones and Rules.</p>
    412 
    413 <p>First, and somewhat trivially, whereas Rules are considered to
    414 contain one or more records, a Zone is considered to be a single
    415 record with zero or more <i>continuation lines</i>. Thus, the keyword,
    416 &ldquo;<code>Zone</code>,&rdquo; and the zone name are not
    417 repeated. The last line is the one without anything in
    418 the <code>[UNTIL]</code> column.</p>
    419 
    420 <p>Second, and more fundamentally, each line of a Zone represents a
    421 steady state, not a transition between states. The state exists from
    422 the date and time in the previous line&rsquo;s <code>[UNTIL]</code>
    423 column up to the date and time in the current
    424 line&rsquo;s <code>[UNTIL]</code> column. In other words, the date and
    425 time in the <code>[UNTIL]</code> column is the instant that separates
    426 this state from the next. Where that would be ambiguous because
    427 we&rsquo;re setting our clocks back, the <code>[UNTIL]</code> column
    428 specifies the first occurrence of the instant. The state specified by
    429 the last line, the one without anything in the <code>[UNTIL]</code>
    430 column, continues to the present.</p>
    431 
    432 <p>The first line typically specifies the mean solar time observed
    433 before the introduction of standard time. Since there&rsquo;s no line before
    434 that, it has no beginning. <code>8-) </code> For some places near the <a
    435 href="https://en.wikipedia.org/wiki/International_Date_Line">International
    436 Date Line</a>, the first <i>two</i> lines will show solar times
    437 differing by 24 hours; this corresponds to a movement of the Date
    438 Line.  For example:</p>
    439 
    440 <pre>
    441 #Zone NAME          STDOFF   RULES FORMAT [UNTIL]
    442 Zone America/Juneau 15:02:19 -     LMT    1867 Oct 18
    443                     -8:57:41 -     LMT    ...
    444 </pre>
    445 
    446 <p>When Alaska was purchased from Russia in 1867, the Date Line moved
    447 from the Alaska/Canada border to the Bering Strait; and the time in
    448 Alaska was then 24 hours earlier than it had
    449 been. <code>&lt;aside&gt;</code>(6 October in the Julian calendar,
    450 which Russia was still using then for religious reasons, was followed
    451 by <i>a second instance of the same day with a different name</i>, 18
    452 October in the Gregorian calendar. Isn&rsquo;t civil time
    453 wonderful? <code>8-)</code>)<code>&lt;/aside&gt;</code></p>
    454 
    455 <p>The abbreviation, &ldquo;LMT&rdquo; stands for &ldquo;local mean
    456 time&rdquo;, which is an invention of
    457 the <a href="https://en.wikipedia.org/wiki/Tz_database">tz
    458 database</a> and was probably never actually used during the
    459 period. Furthermore, the value is almost certainly wrong except in the
    460 archetypal place after which the zone is named. (The tz database
    461 usually doesn&rsquo;t provide a separate Zone record for places where
    462 nothing significant happened after 1970.)</p>
    463 
    464 <p>The <code>RULES</code> column tells us whether daylight saving time is being observed:
    465 <ul>
    466 <li>A hyphen, a kind of null value, means that we have not set our
    467 clocks ahead of standard time.</li>
    468 
    469 <li>An amount of time (usually but not necessarily &ldquo;1:00&rdquo;
    470 meaning one hour) means that we have set our clocks ahead by that
    471 amount.</li>
    472 
    473 <li>Some alphabetic string means that we <i>might have</i> set our
    474 clocks ahead; and we need to check the rule the name of which is the
    475 given alphabetic string.</li>
    476 </ul>
    477 
    478 <p>An example of a specific amount of time is:</p>
    479 <pre>
    480 #Zone NAME            STDOFF RULES FORMAT [UNTIL]
    481 Zone Pacific/Honolulu ...                 1933 Apr 30  2:00
    482                       -10:30 1:00  HDT    1933 May 21 12:00
    483                       ...
    484 </pre>
    485 
    486 <p>Hawaii tried daylight saving time for three weeks in 1933 and
    487 decided they didn&rsquo;t like it. <code>8-) </code>Note that
    488 the <code>STDOFF</code> column always contains the standard time
    489 offset, so the local (wall clock) time during this period was GMT &minus;
    490 10:30 + 1:00 = GMT &minus; 9:30.</p>
    491 
    492 <p>The <code>FORMAT</code> column specifies the usual abbreviation of
    493 the time zone name. It can have one of three forms:</p>
    494 <ul>
    495 
    496 <li>a string of three or more characters that are either ASCII alphanumerics,
    497 &ldquo;<code>+</code>&rdquo;, or &ldquo;<code>-</code>&rdquo;,
    498 in which case that&rsquo;s the abbreviation</li>
    499 
    500 <li>a pair of strings separated by a slash
    501 (&lsquo;<code>/</code>&rsquo;), in which case the first string is the
    502 abbreviation for the standard time name and the second string is the
    503 abbreviation for the daylight saving time name</li>
    504 
    505 <li>a string containing &ldquo;<code>%s</code>,&rdquo; in which case
    506 the &ldquo;<code>%s</code>&rdquo; will be replaced by the text in the
    507 appropriate Rule&rsquo;s <code>LETTER</code> column</li>
    508 </ul>
    509 
    510 <p>The last two make sense only if there&rsquo;s a named rule in effect.</p>
    511 
    512 <p>An example of a slash is:</p>
    513 <pre>
    514 #Zone NAME          STDOFF RULES FORMAT  [UNTIL]
    515 Zone  Europe/London ...                  1996
    516                     0:00   EU    GMT/BST
    517 </pre>
    518 
    519 <p>The current time in the UK is called either Greenwich mean time or
    520 British summer time.</p>
    521 
    522 <p>One wrinkle, not fully explained in <code>zic.8.txt</code>, is what
    523 happens when switching to a named rule. To what values should
    524 the <code>SAVE</code> and <code>LETTER</code> data be initialized?</p>
    525 
    526 <ul>
    527 <li>If at least one transition has happened, use
    528 the <code>SAVE</code> and <code>LETTER</code> data from the most
    529 recent.</li>
    530 
    531 <li>If switching to a named rule before any transition has happened,
    532 assume standard time (<code>SAVE</code> zero), and use
    533 the <code>LETTER</code> data from the earliest transition with
    534 a <code>SAVE</code> of zero.
    535 
    536 </ul>
    537 
    538 <p>And three last things about the <code>FORMAT</code> column:</p>
    539 <ul>
    540 
    541 <li>The <a href="https://en.wikipedia.org/wiki/Tz_database">tz
    542 database</a> gives abbreviations for time zones in <i>popular
    543 usage</i>, which is not necessarily &ldquo;correct&rdquo; by law. For
    544 example, the last line in
    545 <code>Zone</code> <code>Pacific/Honolulu</code> (shown below) gives
    546 &ldquo;HST&rdquo; for &ldquo;Hawaii standard time&rdquo; even though the
    547 <a href="https://www.law.cornell.edu/uscode/text/15/263">legal</a>
    548 name for that time zone is &ldquo;Hawaii-Aleutian standard time.&rdquo;
    549 This author has read that there are also some places in Australia where
    550 popular time zone names differ from the legal ones.
    551 
    552 <li>No attempt is made to <a
    553 href="https://en.wikipedia.org/wiki/Internationalization_and_localization">localize</a>
    554 the abbreviations. They are intended to be the values returned through the
    555 <code>"%Z"</code> format specifier to
    556 <a href="https://en.wikipedia.org/wiki/C_(programming_language)">C</a>&rsquo;s
    557 <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html"><code>strftime</code></a>
    558 function in the
    559 <a href="https://kirste.userpage.fu-berlin.de/chemnet/use/info/libc/libc_19.html#SEC324">&ldquo;C&rdquo; locale</a>.
    560 
    561 <li>If there is no generally-accepted abbreviation for a time zone,
    562 a numeric offset is used instead, e.g., <code>+07</code> for 7 hours
    563 ahead of Greenwich. By convention, <code>-00</code> is used in a
    564 zone while uninhabited, where the offset is zero but in some sense
    565 the true offset is undefined.
    566 </ul>
    567 
    568 <p>As a final example, here&rsquo;s the complete history for Hawaii:</p>
    569 
    570 <table>
    571 <tr>
    572   <th colspan="6">Relevant Excerpts from the US Rules</th>
    573 </tr>
    574 <tr>
    575   <td colspan="6">
    576     <table class="rule">
    577       <tr><td style="border:none;text-align:left">
    578 <pre class="td">
    579 #Rule NAME FROM TO   -    IN  ON      AT     SAVE LETTER/S
    580 Rule  US   1918 1919 -    Oct lastSun  2:00  0    S
    581 Rule  US   1942 only -    Feb  9       2:00  1:00 W # War
    582 Rule  US   1945 only -    Aug 14      23:00u 1:00 P # Peace
    583 Rule  US   1945 only -    Sep lastSun  2:00  0    S
    584 </pre>
    585   </td></tr></table></td>
    586 </tr>
    587 <tr>
    588   <th colspan="6">The Zone Record</th>
    589 </tr>
    590 <tr>
    591   <td colspan="6">
    592     <table class="rule">
    593       <tr><td style="border:none;text-align:left">
    594 <pre class="td">
    595 #Zone NAME            STDOFF    RULES FORMAT [UNTIL]
    596 Zone Pacific/Honolulu -10:31:26 -     LMT    1896 Jan 13 12:00
    597                       -10:30    -     HST    1933 Apr 30  2:00
    598                       -10:30    1:00  HDT    1933 May 21  2:00
    599                       -10:30    US    H%sT   1947 Jun  8  2:00
    600                       -10:00    -     HST
    601 </pre>
    602   </td></tr></table></td>
    603 </tr>
    604 <tr>
    605   <th colspan="6">What We Infer</th>
    606 </tr>
    607 <tr>
    608   <th rowspan="2">Wall-Clock<br>Offset from<br>Prime Meridian</th>
    609   <th rowspan="2">Adjust<br>Clocks</th>
    610   <th colspan="2">Time Zone</th>
    611   <th colspan="2">Ending at Local Time</th>
    612 </tr>
    613 <tr>
    614   <th>Abbrv.</th>
    615   <th>Name</th>
    616   <th>Date</th>
    617   <th>Time</th>
    618 </tr>
    619 <tr>
    620   <td>&minus;10:31:26</td>
    621   <td>&mdash;</td>
    622   <td>LMT</td>
    623   <td>local mean time</td>
    624   <td>1896-01-13</td>
    625   <td>12:00</td>
    626 </tr>
    627 <tr>
    628   <td>&minus;10:30</td>
    629   <td>+0:01:26</td>
    630   <td>HST</td>
    631   <td>Hawaii standard time</td>
    632   <td>1933-04-30</td>
    633   <td>02:00</td>
    634 </tr>
    635 <tr>
    636   <td>&minus;9:30</td>
    637   <td>+1:00</td>
    638   <td>HDT</td>
    639   <td>Hawaii daylight time</td>
    640   <td>1933-05-21</td>
    641   <td>12:00</td>
    642 </tr>
    643 <tr>
    644   <td>&minus;10:30&sup1;</td>
    645   <td>&minus;1:00&sup1;</td>
    646   <td>HST&sup1;</td>
    647   <td>Hawaii standard time</td>
    648   <td>1942-02-09</td>
    649   <td>02:00</td>
    650 </tr>
    651 <tr>
    652   <td rowspan="2">&minus;9:30</td>
    653   <td>+1:00</td>
    654   <td>HWT</td>
    655   <td>Hawaii war time</td>
    656   <td>1945-08-14</td>
    657   <td>13:30&sup2;</td>
    658 </tr>
    659 <tr>
    660   <td>0</td>
    661   <td>HPT</td>
    662   <td>Hawaii peace time</td>
    663   <td>1945-09-30</td>
    664   <td rowspan="2">02:00</td>
    665 </tr>
    666 <tr>
    667   <td>&minus;10:30</td>
    668   <td>&minus;1:00</td>
    669   <td rowspan="2">HST</td>
    670   <td rowspan="2">Hawaii standard time</td>
    671   <td>1947-06-08</td>
    672 </tr>
    673 <tr>
    674   <td>&minus;10:00&sup3;</td>
    675   <td>+0:30&sup3;</td>
    676   <td colspan="2">&mdash;</td>
    677 </tr>
    678 <tr>
    679   <td colspan="6" class="footnote">
    680     &sup1;Switching to US rules&hellip;most recent transition (in 1919) was to standard time
    681   </td>
    682 </tr>
    683 <tr>
    684   <td colspan="6" class="footnote">
    685     &sup2;23:00 <a href="https://en.wikipedia.org/wiki/Universal_Time">UT</a>
    686     + (&minus;9:30) = 13:30 local
    687   </td>
    688 </tr>
    689 <tr>
    690   <td colspan="6" class="footnote">
    691     &sup3;Since <a href="https://en.wikipedia.org/wiki/ISO_8601">1947&ndash;06&ndash;08T12:30Z</a>,
    692     the civil time in Hawaii has been
    693     <a href="https://en.wikipedia.org/wiki/Universal_Time">UT</a>/<a href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time">UTC</a>
    694     &minus; 10:00 year-round.
    695   </td>
    696 </tr>
    697 </table>
    698 
    699 <p>There will be a short quiz later. <code>8-)</code></p>
    700 
    701 <hr>
    702 <address>
    703 This web page is in the public domain, so clarified as of
    704 2015-10-20 by Bill Seymour.
    705 <br>
    706 All suggestions and corrections will be welcome; all flames will be amusing.
    707 Mail to was at pobox dot com.
    708 </address>
    709 </body>
    710 </html>
    711