datetime.sgml 52.7 KB
Newer Older
1
<!--
2
$PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.47 2005/09/09 02:31:48 tgl Exp $
3
-->
4

5
 <appendix id="datetime-appendix">
6
  <title>Date/Time Support</title>
7

8 9
  <para>
   <productname>PostgreSQL</productname> uses an internal heuristic
10
   parser for all date/time input support. Dates and times are input as
11 12 13
   strings, and are broken up into distinct fields with a preliminary
   determination of what kind of information may be in the
   field. Each field is interpreted and either assigned a numeric
Bruce Momjian's avatar
Bruce Momjian committed
14 15
   value, ignored, or rejected.
   The parser contains internal lookup tables for all textual fields,
16
   including months, days of the week, and time zones.
17 18 19 20 21 22 23 24 25
  </para>

  <para>
   This appendix includes information on the content of these
   lookup tables and describes the steps used by the parser to decode
   dates and times.
  </para>

  <sect1>
26 27 28
   <title>Date/Time Input Interpretation</title>

   <para>
29
    The date/time type inputs are all decoded using the following procedure.
30 31 32 33 34 35 36 37 38 39 40 41
   </para>

   <procedure>
    <step>
     <para>
      Break the input string into tokens and categorize each token as
      a string, time, time zone, or number.
     </para>

     <substeps>
      <step>
       <para>
42 43
        If the numeric token contains a colon (<literal>:</>), this is
        a time string. Include all subsequent digits and colons.
44 45 46 47 48
       </para>
      </step>

      <step>
       <para>
49 50 51
        If the numeric token contains a dash (<literal>-</>), slash
        (<literal>/</>), or two or more dots (<literal>.</>), this is
        a date string which may have a text month.
52 53 54 55 56
       </para>
      </step>

      <step>
       <para>
57 58 59 60
        If the token is numeric only, then it is either a single field
        or an ISO 8601 concatenated date (e.g.,
        <literal>19990113</literal> for January 13, 1999) or time
        (e.g., <literal>141516</literal> for 14:15:16).
61 62 63 64 65
       </para>
      </step>

      <step>
       <para>
66 67 68
        If the token starts with a plus (<literal>+</>) or minus
        (<literal>-</>), then it is either a time zone or a special
        field.
69 70 71 72 73 74 75 76 77 78 79 80 81
       </para>
      </step>
     </substeps>
    </step>

    <step>
     <para>
      If the token is a text string, match up with possible strings.
     </para>
     
     <substeps>
      <step>
       <para>
82 83 84 85 86
        Do a binary-search table lookup for the token
        as either a special string (e.g., <literal>today</literal>),
        day (e.g., <literal>Thursday</literal>),
        month (e.g., <literal>January</literal>),
        or noise word (e.g., <literal>at</literal>, <literal>on</literal>).
87 88 89
       </para>

       <para>
90 91 92
        Set field values and bit mask for fields.
        For example, set year, month, day for <literal>today</literal>,
        and additionally hour, minute, second for <literal>now</literal>.
93 94 95 96 97
       </para>
      </step>
      
      <step>
       <para>
98 99
        If not found, do a similar binary-search table lookup to match
        the token with a time zone.
100 101 102 103 104
       </para>
      </step>

      <step>
       <para>
105
        If still not found, throw an error.
106 107 108 109 110 111 112
       </para>
      </step>
     </substeps>
    </step>
    
    <step>
     <para>
113
      When the token is a number or number field:
114 115 116 117 118
     </para>

     <substeps>
      <step>
       <para>
119 120 121 122 123
        If there are eight or six digits,
        and if no other date fields have been previously read, then interpret 
        as a <quote>concatenated date</quote> (e.g.,
        <literal>19990118</literal> or <literal>990118</literal>).
        The interpretation is <literal>YYYYMMDD</> or <literal>YYMMDD</>.
124 125 126 127 128
       </para>
      </step>

      <step>
       <para>
129 130
        If the token is three digits
        and a year has already been read, then interpret as day of year.
131 132 133 134 135
       </para>
      </step>
      
      <step>
       <para>
136 137
        If four or six digits and a year has already been read, then
        interpret as a time (<literal>HHMM</> or <literal>HHMMSS</>).
138 139 140 141 142
       </para>
      </step>

      <step>
       <para>
143 144 145
        If three or more digits and no date fields have yet been found,
        interpret as a year (this forces yy-mm-dd ordering of the remaining
        date fields).
146 147 148 149 150
       </para>
      </step>

      <step>
       <para>
151
        Otherwise the date field ordering is assumed to follow the
152 153
        <varname>DateStyle</> setting: mm-dd-yy, dd-mm-yy, or yy-mm-dd.
        Throw an error if a month or day field is found to be out of range.
154 155 156 157 158 159 160 161 162
       </para>
      </step>
     </substeps>
    </step>

    <step>
     <para>
      If BC has been specified, negate the year and add one for
      internal storage.  (There is no year zero in the Gregorian
163
      calendar, so numerically 1 BC becomes year zero.)
164 165 166 167 168
     </para>
    </step>

    <step>
     <para>
169 170 171
      If BC was not specified, and if the year field was two digits in length,
      then adjust the year to four digits. If the field is less than 70, then
      add 2000, otherwise add 1900.
172 173 174

      <tip>
       <para>
175 176 177 178 179
        Gregorian years AD 1-99 may be entered by using 4 digits with leading
        zeros (e.g., <literal>0099</> is AD 99). Previous versions of
        <productname>PostgreSQL</productname> accepted years with three
        digits and with single digits, but as of version 7.0 the rules have
        been tightened up to reduce the possibility of ambiguity.
180 181 182 183 184 185 186 187
       </para>
      </tip>
     </para>
    </step>
   </procedure>
  </sect1>


Peter Eisentraut's avatar
Peter Eisentraut committed
188
  <sect1 id="datetime-keywords">
189
   <title>Date/Time Key Words</title>
190 191

   <para>
192
    <xref linkend="datetime-month-table"> shows the tokens that are
193
    recognized as names of months.
194 195 196
   </para>

    <table id="datetime-month-table">
197
     <title>Month Names</title>
198 199 200
     <tgroup cols="2">
      <thead>
       <row>
201 202
        <entry>Month</entry>
        <entry>Abbreviations</entry>
203 204 205 206
       </row>
      </thead>
      <tbody>
       <row>
207 208
        <entry>January</entry>
        <entry>Jan</entry>
209 210
       </row>
       <row>
211 212
        <entry>February</entry>
        <entry>Feb</entry>
213 214
       </row>
       <row>
215 216
        <entry>March</entry>
        <entry>Mar</entry>
217 218
       </row>
       <row>
219 220
        <entry>April</entry>
        <entry>Apr</entry>
221 222
       </row>
       <row>
223 224
        <entry>May</entry>
        <entry></entry>
225 226
       </row>
       <row>
227 228
        <entry>June</entry>
        <entry>Jun</entry>
229 230
       </row>
       <row>
231 232
        <entry>July</entry>
        <entry>Jul</entry>
233 234
       </row>
       <row>
235 236
        <entry>August</entry>
        <entry>Aug</entry>
237 238
       </row>
       <row>
239 240
        <entry>September</entry>
        <entry>Sep, Sept</entry>
241 242
       </row>
       <row>
243 244
        <entry>October</entry>
        <entry>Oct</entry>
245 246
       </row>
       <row>
247 248 249 250 251 252
        <entry>November</entry>
        <entry>Nov</entry>
       </row>
       <row>
        <entry>December</entry>
        <entry>Dec</entry>
253 254 255 256 257 258
       </row>
      </tbody>
     </tgroup>
    </table>

    <para>
259
     <xref linkend="datetime-dow-table"> shows the tokens that are
260
     recognized as names of days of the week.
261 262 263
    </para>

     <table id="datetime-dow-table">
264
      <title>Day of the Week Names</title>
265 266
      <tgroup cols="2">
       <thead>
267 268 269 270
        <row>
         <entry>Day</entry>
         <entry>Abbreviations</entry>
        </row>
271 272
       </thead>
       <tbody>
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
        <row>
         <entry>Sunday</entry>
         <entry>Sun</entry>
        </row>
        <row>
         <entry>Monday</entry>
         <entry>Mon</entry>
        </row>
        <row>
         <entry>Tuesday</entry>
         <entry>Tue, Tues</entry>
        </row>
        <row>
         <entry>Wednesday</entry>
         <entry>Wed, Weds</entry>
        </row>
        <row>
         <entry>Thursday</entry>
         <entry>Thu, Thur, Thurs</entry>
        </row>
        <row>
         <entry>Friday</entry>
         <entry>Fri</entry>
        </row>
        <row>
         <entry>Saturday</entry>
         <entry>Sat</entry>
        </row>
301 302 303 304 305
       </tbody>
      </tgroup>
     </table>

   <para>
306 307 308 309 310 311
    <xref linkend="datetime-mod-table"> shows the tokens that serve
    various modifier purposes.
   </para>

    <table id="datetime-mod-table">
     <title>Date/Time Field Modifiers</title>
312 313 314
     <tgroup cols="2">
      <thead>
       <row>
315 316
        <entry>Identifier</entry>
        <entry>Description</entry>
317 318 319 320
       </row>
      </thead>
      <tbody>
       <row>
321 322
        <entry><literal>ABSTIME</literal></entry>
        <entry>Ignored</entry>
323 324
       </row>
       <row>
325 326
        <entry><literal>AM</literal></entry>
        <entry>Time is before 12:00</entry>
327 328
       </row>
       <row>
329 330
        <entry><literal>AT</literal></entry>
        <entry>Ignored</entry>
331 332
       </row>
       <row>
333 334
        <entry><literal>JULIAN</>, <literal>JD</>, <literal>J</></entry>
        <entry>Next field is Julian Day</entry>
335 336
       </row>
       <row>
337 338
        <entry><literal>ON</literal></entry>
        <entry>Ignored</entry>
339 340
       </row>
       <row>
341 342
        <entry><literal>PM</literal></entry>
        <entry>Time is on or after 12:00</entry>
343 344
       </row>
       <row>
345 346
        <entry><literal>T</literal></entry>
        <entry>Next field is time</entry>
347 348 349 350 351 352
       </row>
      </tbody>
     </tgroup>
    </table>

   <para>
353
    The key word <literal>ABSTIME</literal> is ignored for historical
354 355
    reasons: In very old releases of
    <productname>PostgreSQL</productname>, invalid values of type <type>abstime</type>
356 357
    were emitted as <literal>Invalid Abstime</literal>. This is no
    longer the case however and this key word will likely be dropped in
358 359 360
    a future release.
   </para>

361
   <indexterm>
Peter Eisentraut's avatar
Peter Eisentraut committed
362
    <primary>time zone</primary>
363
    <secondary>input abbreviations</secondary>
364
   </indexterm>
365

366
   <para>
367
    <xref linkend="datetime-timezone-input-table"> shows the time zone
368
    abbreviations recognized by <productname>PostgreSQL</productname>
369
    in date/time input values.  Note that these names are <emphasis>not</>
370 371 372
    necessarily used for date/time output &mdash; output is driven by the
    official timezone abbreviation(s) associated with the currently selected
    <xref linkend="guc-timezone"> parameter setting.  (It is
373 374
    likely that future releases will make some use of <varname>timezone</>
    for input as well.)
375 376
   </para>

377
   <para>
378
    The table is organized by time zone offset from <acronym>UTC</>,
379
    rather than alphabetically.  This is intended to facilitate
380
    matching local usage with recognized abbreviations for cases where
381
    these might differ.
382
   </para>
383

384 385
    <table id="datetime-timezone-input-table">
     <title>Time Zone Abbreviations for Input</title>
386 387 388
     <tgroup cols="3">
      <thead>
       <row>
389 390 391
        <entry>Time Zone</entry>
        <entry>Offset from UTC</entry>
        <entry>Description</entry>
392 393 394 395
       </row>
      </thead>
      <tbody>
       <row>
396 397 398
        <entry>NZDT</entry>
        <entry>+13:00</entry>
        <entry>New Zealand Daylight-Saving Time</entry>
399 400
       </row>
       <row>
401 402 403
        <entry>IDLE</entry>
        <entry>+12:00</entry>
        <entry>International Date Line, East</entry>
404 405
       </row>
       <row>
406 407 408
        <entry>NZST</entry>
        <entry>+12:00</entry>
        <entry>New Zealand Standard Time</entry>
409 410
       </row>
       <row>
411 412 413
        <entry>NZT</entry>
        <entry>+12:00</entry>
        <entry>New Zealand Time</entry>
414 415
       </row>
       <row>
416 417 418
        <entry>AESST</entry>
        <entry>+11:00</entry>
        <entry>Australia Eastern Summer Standard Time</entry>
419 420
       </row>
       <row>
421 422 423
        <entry>ACSST</entry>
        <entry>+10:30</entry>
        <entry>Central Australia Summer Standard Time</entry>
424 425
       </row>
       <row>
426 427 428
        <entry>CADT</entry>
        <entry>+10:30</entry>
        <entry>Central Australia Daylight-Saving Time</entry>
429 430
       </row>
       <row>
431 432 433
        <entry>SADT</entry>
        <entry>+10:30</entry>
        <entry>South Australian Daylight-Saving Time</entry>
434 435
       </row>
       <row>
436 437 438
        <entry>AEST</entry>
        <entry>+10:00</entry>
        <entry>Australia Eastern Standard Time</entry>
439 440
       </row>
       <row>
441 442 443
        <entry>EAST</entry>
        <entry>+10:00</entry>
        <entry>East Australian Standard Time</entry>
444 445
       </row>
       <row>
446 447 448
        <entry>GST</entry>
        <entry>+10:00</entry>
        <entry>Guam Standard Time, Russia zone 9</entry>
449 450
       </row>
       <row>
451 452 453
        <entry>LIGT</entry>
        <entry>+10:00</entry>
        <entry>Melbourne, Australia</entry>
454 455
       </row>
       <row>
456 457 458
        <entry>SAST</entry>
        <entry>+09:30</entry>
        <entry>South Australia Standard Time</entry>
459 460
       </row>
       <row>
461 462 463
        <entry>CAST</entry>
        <entry>+09:30</entry>
        <entry>Central Australia Standard Time</entry>
464 465
       </row>
       <row>
466 467 468
        <entry>AWSST</entry>
        <entry>+09:00</entry>
        <entry>Australia Western Summer Standard Time</entry>
469 470
       </row>
       <row>
471 472 473
        <entry>JST</entry>
        <entry>+09:00</entry>
        <entry>Japan Standard Time, Russia zone 8</entry>
474 475
       </row>
       <row>
476 477 478
        <entry>KST</entry>
        <entry>+09:00</entry>
        <entry>Korea Standard Time</entry>
479
       </row>
480
       <row>
481 482 483
        <entry>MHT</entry>
        <entry>+09:00</entry>
        <entry>Kwajalein Time</entry>
484
       </row>
485
       <row>
486 487 488
        <entry>WDT</entry>
        <entry>+09:00</entry>
        <entry>West Australian Daylight-Saving Time</entry>
489 490
       </row>
       <row>
491 492 493
        <entry>MT</entry>
        <entry>+08:30</entry>
        <entry>Moluccas Time</entry>
494 495
       </row>
       <row>
496 497 498
        <entry>AWST</entry>
        <entry>+08:00</entry>
        <entry>Australia Western Standard Time</entry>
499 500
       </row>
       <row>
501 502 503
        <entry>CCT</entry>
        <entry>+08:00</entry>
        <entry>China Coastal Time</entry>
504 505
       </row>
       <row>
506 507 508
        <entry>WADT</entry>
        <entry>+08:00</entry>
        <entry>West Australian Daylight-Saving Time</entry>
509 510
       </row>
       <row>
511 512 513
        <entry>WST</entry>
        <entry>+08:00</entry>
        <entry>West Australian Standard Time</entry>
514 515
       </row>
       <row>
516 517 518
        <entry>JT</entry>
        <entry>+07:30</entry>
        <entry>Java Time</entry>
519
       </row>
520
       <row>
521 522 523
        <entry>ALMST</entry>
        <entry>+07:00</entry>
        <entry>Almaty Summer Time</entry>
524
       </row>
525
       <row>
526 527 528
        <entry>WAST</entry>
        <entry>+07:00</entry>
        <entry>West Australian Standard Time</entry>
529 530
       </row>
       <row>
531 532 533
        <entry>CXT</entry>
        <entry>+07:00</entry>
        <entry>Christmas (Island) Time</entry>
534
       </row>
535
       <row>
536 537 538
        <entry>MMT</entry>
        <entry>+06:30</entry>
        <entry>Myanmar Time</entry>
539 540
       </row>
       <row>
541 542 543
        <entry>ALMT</entry>
        <entry>+06:00</entry>
        <entry>Almaty Time</entry>
544
       </row>
545
       <row>
546 547 548
        <entry>MAWT</entry>
        <entry>+06:00</entry>
        <entry>Mawson (Antarctica) Time</entry>
549
       </row>
550
       <row>
551 552 553
        <entry>IOT</entry>
        <entry>+05:00</entry>
        <entry>Indian Chagos Time</entry>
554 555
       </row>
       <row>
556 557 558
        <entry>MVT</entry>
        <entry>+05:00</entry>
        <entry>Maldives Island Time</entry>
559 560
       </row>
       <row>
561 562 563
        <entry>TFT</entry>
        <entry>+05:00</entry>
        <entry>Kerguelen Time</entry>
564
       </row>
565
       <row>
566 567 568
        <entry>AFT</entry>
        <entry>+04:30</entry>
        <entry>Afghanistan Time</entry>
569
       </row>
570
       <row>
571 572 573
        <entry>EAST</entry>
        <entry>+04:00</entry>
        <entry>Antananarivo Summer Time</entry>
574 575
       </row>
       <row>
576 577 578
        <entry>MUT</entry>
        <entry>+04:00</entry>
        <entry>Mauritius Island Time</entry>
579 580
       </row>
       <row>
581 582 583
        <entry>RET</entry>
        <entry>+04:00</entry>
        <entry>Reunion Island Time</entry>
584 585
       </row>
       <row>
586 587 588
        <entry>SCT</entry>
        <entry>+04:00</entry>
        <entry>Mahe Island Time</entry>
589 590
       </row>
       <row>
591 592 593
        <entry>IRT, IT</entry>
        <entry>+03:30</entry>
        <entry>Iran Time</entry>
594 595
       </row>
       <row>
596 597 598
        <entry>EAT</entry>
        <entry>+03:00</entry>
        <entry>Antananarivo, Comoro Time</entry>
599 600
       </row>
       <row>
601 602 603
        <entry>BT</entry>
        <entry>+03:00</entry>
        <entry>Baghdad Time</entry>
604 605
       </row>
       <row>
606 607 608
        <entry>EETDST</entry>
        <entry>+03:00</entry>
        <entry>Eastern Europe Daylight-Saving Time</entry>
609
       </row>
610
       <row>
611 612 613
        <entry>HMT</entry>
        <entry>+03:00</entry>
        <entry>Hellas Mediterranean Time (?)</entry>
614
       </row>
615
       <row>
616 617 618
        <entry>BDST</entry>
        <entry>+02:00</entry>
        <entry>British Double Summer Time</entry>
619 620
       </row>
       <row>
621 622 623
        <entry>CEST</entry>
        <entry>+02:00</entry>
        <entry>Central European Summer Time</entry>
624 625
       </row>
       <row>
626 627 628
        <entry>CETDST</entry>
        <entry>+02:00</entry>
        <entry>Central European Daylight-Saving Time</entry>
629 630
       </row>
       <row>
631 632 633
        <entry>EET</entry>
        <entry>+02:00</entry>
        <entry>Eastern European Time, Russia zone 1</entry>
634 635
       </row>
       <row>
636 637 638
        <entry>FWT</entry>
        <entry>+02:00</entry>
        <entry>French Winter Time</entry>
639 640
       </row>
       <row>
641 642 643
        <entry>IST</entry>
        <entry>+02:00</entry>
        <entry>Israel Standard Time</entry>
644 645
       </row>
       <row>
646 647 648
        <entry>MEST</entry>
        <entry>+02:00</entry>
        <entry>Middle European Summer Time</entry>
649 650
       </row>
       <row>
651 652 653
        <entry>METDST</entry>
        <entry>+02:00</entry>
        <entry>Middle Europe Daylight-Saving Time</entry>
654 655
       </row>
       <row>
656 657 658
        <entry>SST</entry>
        <entry>+02:00</entry>
        <entry>Swedish Summer Time</entry>
659 660
       </row>
       <row>
661 662 663
        <entry>BST</entry>
        <entry>+01:00</entry>
        <entry>British Summer Time</entry>
664 665
       </row>
       <row>
666 667 668
        <entry>CET</entry>
        <entry>+01:00</entry>
        <entry>Central European Time</entry>
669 670
       </row>
       <row>
671 672 673
        <entry>DNT</entry>
        <entry>+01:00</entry>
        <entry><foreignphrase>Dansk Normal Tid</foreignphrase></entry>
674 675
       </row>
       <row>
676 677 678
        <entry>FST</entry>
        <entry>+01:00</entry>
        <entry>French Summer Time</entry>
679 680
       </row>
       <row>
681 682 683
        <entry>MET</entry>
        <entry>+01:00</entry>
        <entry>Middle European Time</entry>
684 685
       </row>
       <row>
686 687 688
        <entry>MEWT</entry>
        <entry>+01:00</entry>
        <entry>Middle European Winter Time</entry>
689 690
       </row>
       <row>
691 692 693
        <entry>MEZ</entry>
        <entry>+01:00</entry>
        <entry><foreignphrase>Mitteleuropäische Zeit</></entry>
694 695
       </row>
       <row>
696 697 698
        <entry>NOR</entry>
        <entry>+01:00</entry>
        <entry>Norway Standard Time</entry>
699 700
       </row>
       <row>
701 702 703
        <entry>SET</entry>
        <entry>+01:00</entry>
        <entry>Seychelles Time</entry>
704 705
       </row>
       <row>
706 707 708
        <entry>SWT</entry>
        <entry>+01:00</entry>
        <entry>Swedish Winter Time</entry>
709 710
       </row>
       <row>
711 712 713
        <entry>WETDST</entry>
        <entry>+01:00</entry>
        <entry>Western European Daylight-Saving Time</entry>
714 715
       </row>
       <row>
716 717 718
        <entry>GMT</entry>
        <entry>00:00</entry>
        <entry>Greenwich Mean Time</entry>
719
       </row>
720
       <row>
721 722 723
        <entry>UT</entry>
        <entry>00:00</entry>
        <entry>Universal Time</entry>
724 725
       </row>
       <row>
726 727 728
        <entry>UTC</entry>
        <entry>00:00</entry>
        <entry>Universal Coordinated Time</entry>
729 730
       </row>
       <row>
731 732 733
        <entry>Z</entry>
        <entry>00:00</entry>
        <entry>Same as UTC</entry>
734 735
       </row>
       <row>
736 737 738
        <entry>ZULU</entry>
        <entry>00:00</entry>
        <entry>Same as UTC</entry>
739
       </row>
740
       <row>
741 742 743
        <entry>WET</entry>
        <entry>00:00</entry>
        <entry>Western European Time</entry>
744 745
       </row>
       <row>
746 747 748
        <entry>WAT</entry>
        <entry>-01:00</entry>
        <entry>West Africa Time</entry>
749
       </row>
750
       <row>
751 752 753
        <entry>FNST</entry>
        <entry>-01:00</entry>
        <entry>Fernando de Noronha Summer Time</entry>
754 755
       </row>
       <row>
756 757 758
        <entry>FNT</entry>
        <entry>-02:00</entry>
        <entry>Fernando de Noronha Time</entry>
759 760
       </row>
       <row>
761 762 763
        <entry>BRST</entry>
        <entry>-02:00</entry>
        <entry>Brasilia Summer Time</entry>
764
       </row>
765
       <row>
766 767 768
        <entry>NDT</entry>
        <entry>-02:30</entry>
        <entry>Newfoundland Daylight-Saving Time</entry>
769 770
       </row>
       <row>
771 772 773
        <entry>ADT</entry>
        <entry>-03:00</entry>
        <entry>Atlantic Daylight-Saving Time</entry>
774
       </row>
775
       <row>
776 777 778
        <entry>AWT</entry>
        <entry>-03:00</entry>
        <entry>(unknown)</entry>
779
       </row>
780
       <row>
781 782 783
        <entry>BRT</entry>
        <entry>-03:00</entry>
        <entry>Brasilia Time</entry>
784
       </row>
785
       <row>
786 787 788
        <entry>NFT</entry>
        <entry>-03:30</entry>
        <entry>Newfoundland Standard Time</entry>
789 790
       </row>
       <row>
791 792 793
        <entry>NST</entry>
        <entry>-03:30</entry>
        <entry>Newfoundland Standard Time</entry>
794 795
       </row>
       <row>
796 797 798
        <entry>AST</entry>
        <entry>-04:00</entry>
        <entry>Atlantic Standard Time (Canada)</entry>
799
       </row>
800
       <row>
801 802 803
        <entry>ACST</entry>
        <entry>-04:00</entry>
        <entry>Atlantic/Porto Acre Summer Time</entry>
804
       </row>
805
       <row>
806 807 808
        <entry>EDT</entry>
        <entry>-04:00</entry>
        <entry>Eastern Daylight-Saving Time</entry>
809 810
       </row>
       <!--
811
      <row>
812
      <entry>ZP4</entry>
813
      <entry>-04:00</entry>
814
      <entry>GMT +4 hours</entry>
815
      </row>
816
       -->
817
       <row>
818 819 820
        <entry>ACT</entry>
        <entry>-05:00</entry>
        <entry>Atlantic/Porto Acre Standard Time</entry>
821
       </row>
822
       <row>
823 824 825
        <entry>CDT</entry>
        <entry>-05:00</entry>
        <entry>Central Daylight-Saving Time</entry>
826 827
       </row>
       <row>
828 829 830
        <entry>EST</entry>
        <entry>-05:00</entry>
        <entry>Eastern Standard Time</entry>
831 832
       </row>
       <!--
833
      <row>
834
      <entry>ZP5</entry>
835
      <entry>-05:00</entry>
836
      <entry>GMT +5  hours</entry>
837
      </row>
838 839
       -->
       <row>
840 841 842
        <entry>CST</entry>
        <entry>-06:00</entry>
        <entry>Central Standard Time</entry>
843 844
       </row>
       <row>
845 846 847
        <entry>MDT</entry>
        <entry>-06:00</entry>
        <entry>Mountain Daylight-Saving Time</entry>
848 849
       </row>
       <!--
850
      <row>
851
      <entry>ZP6</entry>
852
      <entry>-06:00</entry>
853
      <entry>GMT +6  hours</entry>
854
      </row>
855 856
       -->
       <row>
857 858 859
        <entry>MST</entry>
        <entry>-07:00</entry>
        <entry>Mountain Standard Time</entry>
860 861
       </row>
       <row>
862 863 864
        <entry>PDT</entry>
        <entry>-07:00</entry>
        <entry>Pacific Daylight-Saving Time</entry>
865
       </row>
866
       <row>
867 868 869
        <entry>AKDT</entry>
        <entry>-08:00</entry>
        <entry>Alaska Daylight-Saving Time</entry>
870
       </row>
871
       <row>
872 873 874
        <entry>PST</entry>
        <entry>-08:00</entry>
        <entry>Pacific Standard Time</entry>
875 876
       </row>
       <row>
877 878 879
        <entry>YDT</entry>
        <entry>-08:00</entry>
        <entry>Yukon Daylight-Saving Time</entry>
880
       </row>
881
       <row>
882 883 884
        <entry>AKST</entry>
        <entry>-09:00</entry>
        <entry>Alaska Standard Time</entry>
885
       </row>
886
       <row>
887 888 889
        <entry>HDT</entry>
        <entry>-09:00</entry>
        <entry>Hawaii/Alaska Daylight-Saving Time</entry>
890 891
       </row>
       <row>
892 893 894
        <entry>YST</entry>
        <entry>-09:00</entry>
        <entry>Yukon Standard Time</entry>
895
       </row>
896
       <row>
897 898 899
        <entry>MART</entry>
        <entry>-09:30</entry>
        <entry>Marquesas Time</entry>
900
       </row>
901
       <row>
902 903 904
        <entry>AHST</entry>
        <entry>-10:00</entry>
        <entry>Alaska/Hawaii Standard Time</entry>
905
       </row>
906
       <row>
907 908 909
        <entry>HST</entry>
        <entry>-10:00</entry>
        <entry>Hawaii Standard Time</entry>
910
       </row>
911
       <row>
912 913 914
        <entry>CAT</entry>
        <entry>-10:00</entry>
        <entry>Central Alaska Time</entry>
915 916
       </row>
       <row>
917 918 919
        <entry>NT</entry>
        <entry>-11:00</entry>
        <entry>Nome Time</entry>
920 921
       </row>
       <row>
922 923 924
        <entry>IDLW</entry>
        <entry>-12:00</entry>
        <entry>International Date Line, West</entry>
925 926 927 928
       </row>
      </tbody>
     </tgroup>
    </table>
929

930
  <formalpara>
931 932 933
   <title>Australian Time Zones</title>

   <para>
934
    There are three naming conflicts between Australian time zone
935
    names and time zone names commonly used in North and South America:
936 937
    <literal>ACST</literal>, <literal>CST</literal>, and
    <literal>EST</literal>.  If the run-time option
938
    <varname>australian_timezones</varname> is set to true then
939 940 941 942 943 944 945 946
    <literal>ACST</literal>, <literal>CST</literal>,
    <literal>EST</literal>, and <literal>SAT</literal> are interpreted
    as Australian time zone names, as shown in <xref
    linkend="datetime-oztz-table">. If it is false (which is the
    default), then <literal>ACST</literal>, <literal>CST</literal>,
    and <literal>EST</literal> are taken as American time zone names,
    and <literal>SAT</literal> is interpreted as a noise word
    indicating Saturday.
947
   </para>
948
  </formalpara>
949

950
    <table id="datetime-oztz-table">
951
     <title>Australian Time Zone Abbreviations for Input</title>
952 953 954
     <tgroup cols="3">
      <thead>
       <row>
955 956 957
        <entry>Time Zone</entry>
        <entry>Offset from UTC</entry>
        <entry>Description</entry>
958 959 960
       </row>
      </thead>
      <tbody>
961
       <row>
962 963 964
        <entry>ACST</entry>
        <entry>+09:30</entry>
        <entry>Central Australia Standard Time</entry>
965
       </row>
966
       <row>
967 968 969
        <entry>CST</entry>
        <entry>+10:30</entry>
        <entry>Australian Central Standard Time</entry>
970 971
       </row>
       <row>
972 973 974
        <entry>EST</entry>
        <entry>+10:00</entry>
        <entry>Australian Eastern Standard Time</entry>
975
       </row>
976
       <row>
977 978 979
        <entry>SAT</entry>
        <entry>+09:30</entry>
        <entry>South Australian Standard Time</entry>
980
       </row>
981 982 983
      </tbody>
     </tgroup>
    </table>
984

985 986 987 988 989 990 991 992
   <indexterm>
    <primary>time zone</primary>
    <secondary>configuration names</secondary>
   </indexterm>

   <para>
    <xref linkend="datetime-timezone-set-table"> shows the time zone
    names recognized by <productname>PostgreSQL</productname> as valid
993
    settings for the <xref linkend="guc-timezone"> parameter.  Note that
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006
    these names are conceptually as well as practically different from
    the names shown in <xref linkend="datetime-timezone-input-table">:
    most of these names imply a local daylight-savings time rule, whereas
    the former names each represent just a fixed offset from UTC.
   </para>

   <para>
    In many cases there are several equivalent names for the same zone.
    These are listed on the same line.  The table is primarily sorted
    by the name of the principal city of the zone.
   </para>

    <table id="datetime-timezone-set-table">
1007
     <title>Time Zone Names for Setting <varname>timezone</></title>
1008 1009 1010
     <tgroup cols="1">
      <thead>
       <row>
1011
        <entry>Time Zone</entry>
1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250
       </row>
      </thead>
<tbody>
 <row>
  <entry>Africa/Abidjan</entry>
 </row>
 <row>
  <entry>Africa/Accra</entry>
 </row>
 <row>
  <entry>Africa/Addis_Ababa</entry>
 </row>
 <row>
  <entry>Africa/Algiers</entry>
 </row>
 <row>
  <entry>Africa/Asmera</entry>
 </row>
 <row>
  <entry>Africa/Bamako</entry>
 </row>
 <row>
  <entry>Africa/Bangui</entry>
 </row>
 <row>
  <entry>Africa/Banjul</entry>
 </row>
 <row>
  <entry>Africa/Bissau</entry>
 </row>
 <row>
  <entry>Africa/Blantyre</entry>
 </row>
 <row>
  <entry>Africa/Brazzaville</entry>
 </row>
 <row>
  <entry>Africa/Bujumbura</entry>
 </row>
 <row>
  <entry>Africa/Cairo Egypt</entry>
 </row>
 <row>
  <entry>Africa/Casablanca</entry>
 </row>
 <row>
  <entry>Africa/Ceuta</entry>
 </row>
 <row>
  <entry>Africa/Conakry</entry>
 </row>
 <row>
  <entry>Africa/Dakar</entry>
 </row>
 <row>
  <entry>Africa/Dar_es_Salaam</entry>
 </row>
 <row>
  <entry>Africa/Djibouti</entry>
 </row>
 <row>
  <entry>Africa/Douala</entry>
 </row>
 <row>
  <entry>Africa/El_Aaiun</entry>
 </row>
 <row>
  <entry>Africa/Freetown</entry>
 </row>
 <row>
  <entry>Africa/Gaborone</entry>
 </row>
 <row>
  <entry>Africa/Harare</entry>
 </row>
 <row>
  <entry>Africa/Johannesburg</entry>
 </row>
 <row>
  <entry>Africa/Kampala</entry>
 </row>
 <row>
  <entry>Africa/Khartoum</entry>
 </row>
 <row>
  <entry>Africa/Kigali</entry>
 </row>
 <row>
  <entry>Africa/Kinshasa</entry>
 </row>
 <row>
  <entry>Africa/Lagos</entry>
 </row>
 <row>
  <entry>Africa/Libreville</entry>
 </row>
 <row>
  <entry>Africa/Lome</entry>
 </row>
 <row>
  <entry>Africa/Luanda</entry>
 </row>
 <row>
  <entry>Africa/Lubumbashi</entry>
 </row>
 <row>
  <entry>Africa/Lusaka</entry>
 </row>
 <row>
  <entry>Africa/Malabo</entry>
 </row>
 <row>
  <entry>Africa/Maputo</entry>
 </row>
 <row>
  <entry>Africa/Maseru</entry>
 </row>
 <row>
  <entry>Africa/Mbabane</entry>
 </row>
 <row>
  <entry>Africa/Mogadishu</entry>
 </row>
 <row>
  <entry>Africa/Monrovia</entry>
 </row>
 <row>
  <entry>Africa/Nairobi</entry>
 </row>
 <row>
  <entry>Africa/Ndjamena</entry>
 </row>
 <row>
  <entry>Africa/Niamey</entry>
 </row>
 <row>
  <entry>Africa/Nouakchott</entry>
 </row>
 <row>
  <entry>Africa/Ouagadougou</entry>
 </row>
 <row>
  <entry>Africa/Porto-Novo</entry>
 </row>
 <row>
  <entry>Africa/Sao_Tome</entry>
 </row>
 <row>
  <entry>Africa/Timbuktu</entry>
 </row>
 <row>
  <entry>Africa/Tripoli Libya</entry>
 </row>
 <row>
  <entry>Africa/Tunis</entry>
 </row>
 <row>
  <entry>Africa/Windhoek</entry>
 </row>
 <row>
  <entry>America/Adak America/Atka US/Aleutian</entry>
 </row>
 <row>
  <entry>America/Anchorage SystemV/YST9YDT US/Alaska</entry>
 </row>
 <row>
  <entry>America/Anguilla</entry>
 </row>
 <row>
  <entry>America/Antigua</entry>
 </row>
 <row>
  <entry>America/Araguaina</entry>
 </row>
 <row>
  <entry>America/Aruba</entry>
 </row>
 <row>
  <entry>America/Asuncion</entry>
 </row>
 <row>
  <entry>America/Bahia</entry>
 </row>
 <row>
  <entry>America/Barbados</entry>
 </row>
 <row>
  <entry>America/Belem</entry>
 </row>
 <row>
  <entry>America/Belize</entry>
 </row>
 <row>
  <entry>America/Boa_Vista</entry>
 </row>
 <row>
  <entry>America/Bogota</entry>
 </row>
 <row>
  <entry>America/Boise</entry>
 </row>
 <row>
  <entry>America/Buenos_Aires</entry>
 </row>
 <row>
  <entry>America/Cambridge_Bay</entry>
 </row>
 <row>
  <entry>America/Campo_Grande</entry>
 </row>
 <row>
  <entry>America/Cancun</entry>
 </row>
 <row>
  <entry>America/Caracas</entry>
 </row>
 <row>
  <entry>America/Catamarca</entry>
 </row>
 <row>
  <entry>America/Cayenne</entry>
 </row>
 <row>
  <entry>America/Cayman</entry>
 </row>
 <row>
  <entry>America/Chicago CST6CDT SystemV/CST6CDT US/Central</entry>
 </row>
 <row>
  <entry>America/Chihuahua</entry>
 </row>
 <row>
  <entry>America/Cordoba America/Rosario</entry>
 </row>
 <row>
  <entry>America/Costa_Rica</entry>
 </row>
 <row>
  <entry>America/Cuiaba</entry>
 </row>
 <row>
  <entry>America/Curacao</entry>
 </row>
 <row>
  <entry>America/Danmarkshavn</entry>
 </row>
 <row>
  <entry>America/Dawson</entry>
 </row>
 <row>
  <entry>America/Dawson_Creek</entry>
 </row>
 <row>
  <entry>America/Denver MST7MDT SystemV/MST7MDT US/Mountain America/Shiprock Navajo</entry>
 </row>
 <row>
  <entry>America/Detroit US/Michigan</entry>
 </row>
 <row>
  <entry>America/Dominica</entry>
 </row>
 <row>
  <entry>America/Edmonton Canada/Mountain</entry>
 </row>
 <row>
  <entry>America/Eirunepe</entry>
 </row>
 <row>
  <entry>America/El_Salvador</entry>
 </row>
 <row>
  <entry>America/Ensenada America/Tijuana Mexico/BajaNorte</entry>
 </row>
 <row>
  <entry>America/Fortaleza</entry>
 </row>
 <row>
  <entry>America/Glace_Bay</entry>
 </row>
 <row>
  <entry>America/Godthab</entry>
 </row>
 <row>
  <entry>America/Goose_Bay</entry>
 </row>
 <row>
  <entry>America/Grand_Turk</entry>
 </row>
 <row>
  <entry>America/Grenada</entry>
 </row>
 <row>
  <entry>America/Guadeloupe</entry>
 </row>
 <row>
  <entry>America/Guatemala</entry>
 </row>
 <row>
  <entry>America/Guayaquil</entry>
 </row>
 <row>
  <entry>America/Guyana</entry>
 </row>
 <row>
  <entry>America/Halifax Canada/Atlantic SystemV/AST4ADT</entry>
 </row>
 <row>
  <entry>America/Havana Cuba</entry>
 </row>
 <row>
  <entry>America/Hermosillo</entry>
 </row>
 <row>
  <entry>America/Indiana/Indianapolis America/Indianapolis America/Fort_Wayne EST SystemV/EST5 US/East-Indiana</entry>
 </row>
 <row>
  <entry>America/Indiana/Knox America/Knox_IN US/Indiana-Starke</entry>
 </row>
 <row>
  <entry>America/Indiana/Marengo</entry>
 </row>
 <row>
  <entry>America/Indiana/Vevay</entry>
 </row>
 <row>
  <entry>America/Inuvik</entry>
 </row>
 <row>
  <entry>America/Iqaluit</entry>
 </row>
 <row>
  <entry>America/Jamaica Jamaica</entry>
 </row>
 <row>
  <entry>America/Jujuy</entry>
 </row>
 <row>
  <entry>America/Juneau</entry>
 </row>
 <row>
  <entry>America/Kentucky/Louisville America/Louisville</entry>
 </row>
 <row>
  <entry>America/Kentucky/Monticello</entry>
 </row>
 <row>
  <entry>America/La_Paz</entry>
 </row>
 <row>
  <entry>America/Lima</entry>
 </row>
 <row>
  <entry>America/Los_Angeles PST8PDT SystemV/PST8PDT US/Pacific US/Pacific-New</entry>
 </row>
 <row>
  <entry>America/Maceio</entry>
 </row>
 <row>
  <entry>America/Managua</entry>
 </row>
 <row>
  <entry>America/Manaus Brazil/West</entry>
 </row>
 <row>
  <entry>America/Martinique</entry>
 </row>
 <row>
  <entry>America/Mazatlan Mexico/BajaSur</entry>
 </row>
 <row>
  <entry>America/Mendoza</entry>
 </row>
 <row>
  <entry>America/Menominee</entry>
 </row>
 <row>
  <entry>America/Merida</entry>
 </row>
 <row>
  <entry>America/Mexico_City Mexico/General</entry>
 </row>
 <row>
  <entry>America/Miquelon</entry>
 </row>
 <row>
  <entry>America/Monterrey</entry>
 </row>
 <row>
  <entry>America/Montevideo</entry>
 </row>
 <row>
  <entry>America/Montreal</entry>
 </row>
 <row>
  <entry>America/Montserrat</entry>
 </row>
 <row>
  <entry>America/Nassau</entry>
 </row>
 <row>
  <entry>America/New_York EST5EDT SystemV/EST5EDT US/Eastern</entry>
 </row>
 <row>
  <entry>America/Nipigon</entry>
 </row>
 <row>
  <entry>America/Nome</entry>
 </row>
 <row>
  <entry>America/Noronha Brazil/DeNoronha</entry>
 </row>
 <row>
  <entry>America/North_Dakota/Center</entry>
 </row>
 <row>
  <entry>America/Panama</entry>
 </row>
 <row>
  <entry>America/Pangnirtung</entry>
 </row>
 <row>
  <entry>America/Paramaribo</entry>
 </row>
 <row>
  <entry>America/Phoenix MST SystemV/MST7 US/Arizona</entry>
 </row>
 <row>
  <entry>America/Port-au-Prince</entry>
 </row>
 <row>
  <entry>America/Port_of_Spain</entry>
 </row>
 <row>
  <entry>America/Porto_Acre America/Rio_Branco Brazil/Acre</entry>
 </row>
 <row>
  <entry>America/Porto_Velho</entry>
 </row>
 <row>
  <entry>America/Puerto_Rico SystemV/AST4</entry>
 </row>
 <row>
  <entry>America/Rainy_River</entry>
 </row>
 <row>
  <entry>America/Rankin_Inlet</entry>
 </row>
 <row>
  <entry>America/Recife</entry>
 </row>
 <row>
  <entry>America/Regina Canada/East-Saskatchewan Canada/Saskatchewan SystemV/CST6</entry>
 </row>
 <row>
  <entry>America/Santiago Chile/Continental</entry>
 </row>
 <row>
  <entry>America/Santo_Domingo</entry>
 </row>
 <row>
  <entry>America/Sao_Paulo Brazil/East</entry>
 </row>
 <row>
  <entry>America/Scoresbysund</entry>
 </row>
 <row>
  <entry>America/St_Johns Canada/Newfoundland</entry>
 </row>
 <row>
  <entry>America/St_Kitts</entry>
 </row>
 <row>
  <entry>America/St_Lucia</entry>
 </row>
 <row>
  <entry>America/St_Thomas America/Virgin</entry>
 </row>
 <row>
  <entry>America/St_Vincent</entry>
 </row>
 <row>
  <entry>America/Swift_Current</entry>
 </row>
 <row>
  <entry>America/Tegucigalpa</entry>
 </row>
 <row>
  <entry>America/Thule</entry>
 </row>
 <row>
  <entry>America/Thunder_Bay</entry>
 </row>
 <row>
  <entry>America/Toronto Canada/Eastern</entry>
 </row>
 <row>
  <entry>America/Tortola</entry>
 </row>
 <row>
  <entry>America/Vancouver Canada/Pacific</entry>
 </row>
 <row>
  <entry>America/Whitehorse Canada/Yukon</entry>
 </row>
 <row>
  <entry>America/Winnipeg Canada/Central</entry>
 </row>
 <row>
  <entry>America/Yakutat</entry>
 </row>
 <row>
  <entry>America/Yellowknife</entry>
 </row>
 <row>
  <entry>Antarctica/Casey</entry>
 </row>
 <row>
  <entry>Antarctica/Davis</entry>
 </row>
 <row>
  <entry>Antarctica/DumontDUrville</entry>
 </row>
 <row>
  <entry>Antarctica/Mawson</entry>
 </row>
 <row>
  <entry>Antarctica/McMurdo Antarctica/South_Pole</entry>
 </row>
 <row>
  <entry>Antarctica/Palmer</entry>
 </row>
 <row>
  <entry>Antarctica/Rothera</entry>
 </row>
 <row>
  <entry>Antarctica/Syowa</entry>
 </row>
 <row>
  <entry>Antarctica/Vostok</entry>
 </row>
 <row>
  <entry>Asia/Aden</entry>
 </row>
 <row>
  <entry>Asia/Almaty</entry>
 </row>
 <row>
  <entry>Asia/Amman</entry>
 </row>
 <row>
  <entry>Asia/Anadyr</entry>
 </row>
 <row>
  <entry>Asia/Aqtau</entry>
 </row>
 <row>
  <entry>Asia/Aqtobe</entry>
 </row>
 <row>
  <entry>Asia/Ashgabat Asia/Ashkhabad</entry>
 </row>
 <row>
  <entry>Asia/Baghdad</entry>
 </row>
 <row>
  <entry>Asia/Bahrain</entry>
 </row>
 <row>
  <entry>Asia/Baku</entry>
 </row>
 <row>
  <entry>Asia/Bangkok</entry>
 </row>
 <row>
  <entry>Asia/Beirut</entry>
 </row>
 <row>
  <entry>Asia/Bishkek</entry>
 </row>
 <row>
  <entry>Asia/Brunei</entry>
 </row>
 <row>
  <entry>Asia/Calcutta</entry>
 </row>
 <row>
  <entry>Asia/Choibalsan</entry>
 </row>
 <row>
  <entry>Asia/Chongqing Asia/Chungking</entry>
 </row>
 <row>
  <entry>Asia/Colombo</entry>
 </row>
 <row>
  <entry>Asia/Dacca Asia/Dhaka</entry>
 </row>
 <row>
  <entry>Asia/Damascus</entry>
 </row>
 <row>
  <entry>Asia/Dili</entry>
 </row>
 <row>
  <entry>Asia/Dubai</entry>
 </row>
 <row>
  <entry>Asia/Dushanbe</entry>
 </row>
 <row>
  <entry>Asia/Gaza</entry>
 </row>
 <row>
  <entry>Asia/Harbin</entry>
 </row>
 <row>
  <entry>Asia/Hong_Kong Hongkong</entry>
 </row>
 <row>
  <entry>Asia/Hovd</entry>
 </row>
 <row>
  <entry>Asia/Irkutsk</entry>
 </row>
 <row>
  <entry>Asia/Jakarta</entry>
 </row>
 <row>
  <entry>Asia/Jayapura</entry>
 </row>
 <row>
  <entry>Asia/Jerusalem Asia/Tel_Aviv Israel</entry>
 </row>
 <row>
  <entry>Asia/Kabul</entry>
 </row>
 <row>
  <entry>Asia/Kamchatka</entry>
 </row>
 <row>
  <entry>Asia/Karachi</entry>
 </row>
 <row>
  <entry>Asia/Kashgar</entry>
 </row>
 <row>
  <entry>Asia/Katmandu</entry>
 </row>
 <row>
  <entry>Asia/Krasnoyarsk</entry>
 </row>
 <row>
  <entry>Asia/Kuala_Lumpur</entry>
 </row>
 <row>
  <entry>Asia/Kuching</entry>
 </row>
 <row>
  <entry>Asia/Kuwait</entry>
 </row>
 <row>
  <entry>Asia/Macao Asia/Macau</entry>
 </row>
 <row>
  <entry>Asia/Magadan</entry>
 </row>
 <row>
  <entry>Asia/Makassar Asia/Ujung_Pandang</entry>
 </row>
 <row>
  <entry>Asia/Manila</entry>
 </row>
 <row>
  <entry>Asia/Muscat</entry>
 </row>
 <row>
  <entry>Asia/Nicosia Europe/Nicosia</entry>
 </row>
 <row>
  <entry>Asia/Novosibirsk</entry>
 </row>
 <row>
  <entry>Asia/Omsk</entry>
 </row>
 <row>
  <entry>Asia/Oral</entry>
 </row>
 <row>
  <entry>Asia/Phnom_Penh</entry>
 </row>
 <row>
  <entry>Asia/Pontianak</entry>
 </row>
 <row>
  <entry>Asia/Pyongyang</entry>
 </row>
 <row>
  <entry>Asia/Qatar</entry>
 </row>
 <row>
  <entry>Asia/Qyzylorda</entry>
 </row>
 <row>
  <entry>Asia/Rangoon</entry>
 </row>
 <row>
  <entry>Asia/Riyadh</entry>
 </row>
 <row>
  <entry>Asia/Riyadh87 Mideast/Riyadh87</entry>
 </row>
 <row>
  <entry>Asia/Riyadh88 Mideast/Riyadh88</entry>
 </row>
 <row>
  <entry>Asia/Riyadh89 Mideast/Riyadh89</entry>
 </row>
 <row>
  <entry>Asia/Saigon</entry>
 </row>
 <row>
  <entry>Asia/Sakhalin</entry>
 </row>
 <row>
  <entry>Asia/Samarkand</entry>
 </row>
 <row>
  <entry>Asia/Seoul ROK</entry>
 </row>
 <row>
  <entry>Asia/Shanghai PRC</entry>
 </row>
 <row>
  <entry>Asia/Singapore Singapore</entry>
 </row>
 <row>
  <entry>Asia/Taipei ROC</entry>
 </row>
 <row>
  <entry>Asia/Tashkent</entry>
 </row>
 <row>
  <entry>Asia/Tbilisi</entry>
 </row>
 <row>
  <entry>Asia/Tehran Iran</entry>
 </row>
 <row>
  <entry>Asia/Thimbu Asia/Thimphu</entry>
 </row>
 <row>
  <entry>Asia/Tokyo Japan</entry>
 </row>
 <row>
  <entry>Asia/Ulaanbaatar Asia/Ulan_Bator</entry>
 </row>
 <row>
  <entry>Asia/Urumqi</entry>
 </row>
 <row>
  <entry>Asia/Vientiane</entry>
 </row>
 <row>
  <entry>Asia/Vladivostok</entry>
 </row>
 <row>
  <entry>Asia/Yakutsk</entry>
 </row>
 <row>
  <entry>Asia/Yekaterinburg</entry>
 </row>
 <row>
  <entry>Asia/Yerevan</entry>
 </row>
 <row>
  <entry>Atlantic/Azores</entry>
 </row>
 <row>
  <entry>Atlantic/Bermuda</entry>
 </row>
 <row>
  <entry>Atlantic/Canary</entry>
 </row>
 <row>
  <entry>Atlantic/Cape_Verde</entry>
 </row>
 <row>
  <entry>Atlantic/Faeroe</entry>
 </row>
 <row>
  <entry>Atlantic/Madeira</entry>
 </row>
 <row>
  <entry>Atlantic/Reykjavik Iceland</entry>
 </row>
 <row>
  <entry>Atlantic/South_Georgia</entry>
 </row>
 <row>
  <entry>Atlantic/St_Helena</entry>
 </row>
 <row>
  <entry>Atlantic/Stanley</entry>
 </row>
 <row>
  <entry>Australia/ACT Australia/Canberra Australia/NSW Australia/Sydney</entry>
 </row>
 <row>
  <entry>Australia/Adelaide Australia/South</entry>
 </row>
 <row>
  <entry>Australia/Brisbane Australia/Queensland</entry>
 </row>
 <row>
  <entry>Australia/Broken_Hill Australia/Yancowinna</entry>
 </row>
 <row>
  <entry>Australia/Darwin Australia/North</entry>
 </row>
 <row>
  <entry>Australia/Hobart Australia/Tasmania</entry>
 </row>
 <row>
  <entry>Australia/LHI Australia/Lord_Howe</entry>
 </row>
 <row>
  <entry>Australia/Lindeman</entry>
 </row>
 <row>
  <entry>Australia/Melbourne Australia/Victoria</entry>
 </row>
 <row>
  <entry>Australia/Perth Australia/West</entry>
 </row>
 <row>
  <entry>CET</entry>
 </row>
 <row>
  <entry>EET</entry>
 </row>
 <row>
  <entry>Etc/GMT+1</entry>
 </row>
 <row>
  <entry>Etc/GMT+2</entry>
 </row>
 <row>
  <entry>Etc/GMT+3</entry>
 </row>
 <row>
  <entry>Etc/GMT+4</entry>
 </row>
 <row>
  <entry>Etc/GMT+5</entry>
 </row>
 <row>
  <entry>Etc/GMT+6</entry>
 </row>
 <row>
  <entry>Etc/GMT+7</entry>
 </row>
 <row>
  <entry>Etc/GMT+8</entry>
 </row>
 <row>
  <entry>Etc/GMT+9</entry>
 </row>
 <row>
  <entry>Etc/GMT+10</entry>
 </row>
 <row>
  <entry>Etc/GMT+11</entry>
 </row>
 <row>
  <entry>Etc/GMT+12</entry>
 </row>
 <row>
  <entry>Etc/GMT-1</entry>
 </row>
 <row>
  <entry>Etc/GMT-2</entry>
 </row>
 <row>
  <entry>Etc/GMT-3</entry>
 </row>
 <row>
  <entry>Etc/GMT-4</entry>
 </row>
 <row>
  <entry>Etc/GMT-5</entry>
 </row>
 <row>
  <entry>Etc/GMT-6</entry>
 </row>
 <row>
  <entry>Etc/GMT-7</entry>
 </row>
 <row>
  <entry>Etc/GMT-8</entry>
 </row>
 <row>
  <entry>Etc/GMT-9</entry>
 </row>
 <row>
  <entry>Etc/GMT-10</entry>
 </row>
 <row>
  <entry>Etc/GMT-11</entry>
 </row>
 <row>
  <entry>Etc/GMT-12</entry>
 </row>
 <row>
  <entry>Etc/GMT-13</entry>
 </row>
 <row>
  <entry>Etc/GMT-14</entry>
 </row>
 <row>
  <entry>Europe/Amsterdam</entry>
 </row>
 <row>
  <entry>Europe/Andorra</entry>
 </row>
 <row>
  <entry>Europe/Athens</entry>
 </row>
 <row>
  <entry>Europe/Belfast</entry>
 </row>
 <row>
  <entry>Europe/Belgrade Europe/Ljubljana Europe/Sarajevo Europe/Skopje Europe/Zagreb</entry>
 </row>
 <row>
  <entry>Europe/Berlin</entry>
 </row>
 <row>
  <entry>Europe/Brussels</entry>
 </row>
 <row>
  <entry>Europe/Bucharest</entry>
 </row>
 <row>
  <entry>Europe/Budapest</entry>
 </row>
 <row>
  <entry>Europe/Chisinau Europe/Tiraspol</entry>
 </row>
 <row>
  <entry>Europe/Copenhagen</entry>
 </row>
 <row>
  <entry>Europe/Dublin Eire</entry>
 </row>
 <row>
  <entry>Europe/Gibraltar</entry>
 </row>
 <row>
  <entry>Europe/Helsinki</entry>
 </row>
 <row>
  <entry>Europe/Istanbul Asia/Istanbul Turkey</entry>
 </row>
 <row>
  <entry>Europe/Kaliningrad</entry>
 </row>
 <row>
  <entry>Europe/Kiev</entry>
 </row>
 <row>
  <entry>Europe/Lisbon Portugal</entry>
 </row>
 <row>
  <entry>Europe/London GB GB-Eire</entry>
 </row>
 <row>
  <entry>Europe/Luxembourg</entry>
 </row>
 <row>
  <entry>Europe/Madrid</entry>
 </row>
 <row>
  <entry>Europe/Malta</entry>
 </row>
 <row>
  <entry>Europe/Minsk</entry>
 </row>
 <row>
  <entry>Europe/Monaco</entry>
 </row>
 <row>
  <entry>Europe/Moscow W-SU</entry>
 </row>
 <row>
  <entry>Europe/Oslo Arctic/Longyearbyen Atlantic/Jan_Mayen</entry>
 </row>
 <row>
  <entry>Europe/Paris</entry>
 </row>
 <row>
  <entry>Europe/Prague Europe/Bratislava</entry>
 </row>
 <row>
  <entry>Europe/Riga</entry>
 </row>
 <row>
  <entry>Europe/Rome Europe/San_Marino Europe/Vatican</entry>
 </row>
 <row>
  <entry>Europe/Samara</entry>
 </row>
 <row>
  <entry>Europe/Simferopol</entry>
 </row>
 <row>
  <entry>Europe/Sofia</entry>
 </row>
 <row>
  <entry>Europe/Stockholm</entry>
 </row>
 <row>
  <entry>Europe/Tallinn</entry>
 </row>
 <row>
  <entry>Europe/Tirane</entry>
 </row>
 <row>
  <entry>Europe/Uzhgorod</entry>
 </row>
 <row>
  <entry>Europe/Vaduz</entry>
 </row>
 <row>
  <entry>Europe/Vienna</entry>
 </row>
 <row>
  <entry>Europe/Vilnius</entry>
 </row>
 <row>
  <entry>Europe/Warsaw Poland</entry>
 </row>
 <row>
  <entry>Europe/Zaporozhye</entry>
 </row>
 <row>
  <entry>Europe/Zurich</entry>
 </row>
 <row>
  <entry>Factory</entry>
 </row>
 <row>
  <entry>GMT GMT+0 GMT-0 GMT0 Greenwich Etc/GMT Etc/GMT+0 Etc/GMT-0 Etc/GMT0 Etc/Greenwich</entry>
 </row>
 <row>
  <entry>Indian/Antananarivo</entry>
 </row>
 <row>
  <entry>Indian/Chagos</entry>
 </row>
 <row>
  <entry>Indian/Christmas</entry>
 </row>
 <row>
  <entry>Indian/Cocos</entry>
 </row>
 <row>
  <entry>Indian/Comoro</entry>
 </row>
 <row>
  <entry>Indian/Kerguelen</entry>
 </row>
 <row>
  <entry>Indian/Mahe</entry>
 </row>
 <row>
  <entry>Indian/Maldives</entry>
 </row>
 <row>
  <entry>Indian/Mauritius</entry>
 </row>
 <row>
  <entry>Indian/Mayotte</entry>
 </row>
 <row>
  <entry>Indian/Reunion</entry>
 </row>
 <row>
  <entry>MET</entry>
 </row>
 <row>
  <entry>Pacific/Apia</entry>
 </row>
 <row>
  <entry>Pacific/Auckland NZ</entry>
 </row>
 <row>
  <entry>Pacific/Chatham NZ-CHAT</entry>
 </row>
 <row>
  <entry>Pacific/Easter Chile/EasterIsland</entry>
 </row>
 <row>
  <entry>Pacific/Efate</entry>
 </row>
 <row>
  <entry>Pacific/Enderbury</entry>
 </row>
 <row>
  <entry>Pacific/Fakaofo</entry>
 </row>
 <row>
  <entry>Pacific/Fiji</entry>
 </row>
 <row>
  <entry>Pacific/Funafuti</entry>
 </row>
 <row>
  <entry>Pacific/Galapagos</entry>
 </row>
 <row>
  <entry>Pacific/Gambier SystemV/YST9</entry>
 </row>
 <row>
  <entry>Pacific/Guadalcanal</entry>
 </row>
 <row>
  <entry>Pacific/Guam</entry>
 </row>
 <row>
  <entry>Pacific/Honolulu HST SystemV/HST10 US/Hawaii</entry>
 </row>
 <row>
  <entry>Pacific/Johnston</entry>
 </row>
 <row>
  <entry>Pacific/Kiritimati</entry>
 </row>
 <row>
  <entry>Pacific/Kosrae</entry>
 </row>
 <row>
  <entry>Pacific/Kwajalein Kwajalein</entry>
 </row>
 <row>
  <entry>Pacific/Majuro</entry>
 </row>
 <row>
  <entry>Pacific/Marquesas</entry>
 </row>
 <row>
  <entry>Pacific/Midway</entry>
 </row>
 <row>
  <entry>Pacific/Nauru</entry>
 </row>
 <row>
  <entry>Pacific/Niue</entry>
 </row>
 <row>
  <entry>Pacific/Norfolk</entry>
 </row>
 <row>
  <entry>Pacific/Noumea</entry>
 </row>
 <row>
  <entry>Pacific/Pago_Pago Pacific/Samoa US/Samoa</entry>
 </row>
 <row>
  <entry>Pacific/Palau</entry>
 </row>
 <row>
  <entry>Pacific/Pitcairn SystemV/PST8</entry>
 </row>
 <row>
  <entry>Pacific/Ponape</entry>
 </row>
 <row>
  <entry>Pacific/Port_Moresby</entry>
 </row>
 <row>
  <entry>Pacific/Rarotonga</entry>
 </row>
 <row>
  <entry>Pacific/Saipan</entry>
 </row>
 <row>
  <entry>Pacific/Tahiti</entry>
 </row>
 <row>
  <entry>Pacific/Tarawa</entry>
 </row>
 <row>
  <entry>Pacific/Tongatapu</entry>
 </row>
 <row>
  <entry>Pacific/Truk</entry>
 </row>
 <row>
  <entry>Pacific/Wake</entry>
 </row>
 <row>
  <entry>Pacific/Wallis</entry>
 </row>
 <row>
  <entry>Pacific/Yap</entry>
 </row>
 <row>
  <entry>UCT Etc/UCT</entry>
 </row>
 <row>
  <entry>UTC Universal Zulu Etc/UTC Etc/Universal Etc/Zulu</entry>
 </row>
 <row>
  <entry>WET</entry>
 </row>
</tbody>
     </tgroup>
    </table>

   <para>
    In addition to the names listed in the table,
    <productname>PostgreSQL</productname> will accept time zone names of the
    form <replaceable>STD</><replaceable>offset</> or
    <replaceable>STD</><replaceable>offset</><replaceable>DST</>, where
    <replaceable>STD</> is a zone abbreviation, <replaceable>offset</> is a
    numeric offset in hours west from UTC, and <replaceable>DST</> is an
    optional daylight-savings zone abbreviation, assumed to stand for one hour
    ahead of the given offset.  For example, if <literal>EST5EDT</> were not
    already a recognized zone name, it would be accepted and would be
    functionally equivalent to USA East Coast time.  When a daylight-savings
    zone name is present, it is assumed to be used according to USA time zone
    rules, so this feature is of limited use outside North America.
    One should also be wary that this provision can lead to
    silently accepting bogus input, since there is no check on the
    reasonableness of the zone abbreviations.  For example,
    <literal>SET TIMEZONE TO FOOBAR0</> will work, leaving the system
    effectively using a rather peculiar abbreviation for GMT.
   </para>

2251
  </sect1>
2252

2253
  <sect1 id="datetime-units-history">
2254
  <title>History of Units</title>
2255

2256
  <para>
2257
   The Julian Date was invented by the French scholar
2258
   Joseph Justus Scaliger (1540-1609)
Tom Lane's avatar
Tom Lane committed
2259
   and probably takes its name from Scaliger's father,
2260 2261
   the Italian scholar Julius Caesar Scaliger (1484-1558).
   Astronomers have used the Julian period to assign a unique number to
2262
   every day since 1 January 4713 BC. This is the so-called Julian Date
2263 2264 2265 2266
   (JD). JD 0 designates the 24 hours from noon UTC on 1 January 4713 BC
   to noon UTC on 2 January 4713 BC.
  </para>

2267
   <para>
2268 2269
   The <quote>Julian Date</quote> is different from the <quote>Julian
   Calendar</quote>.  The Julian calendar
2270
   was introduced by Julius Caesar in 45 BC. It was in common use
Tom Lane's avatar
Tom Lane committed
2271
   until the year 1582, when countries started changing to the Gregorian
2272 2273 2274
   calendar.  In the Julian calendar, the tropical year is
   approximated as 365 1/4 days = 365.25 days. This gives an error of
   about 1 day in 128 years.
2275 2276 2277
  </para>

  <para>   
2278 2279 2280
   The accumulating calendar error prompted
   Pope Gregory XIII to reform the calendar in accordance with
   instructions from the Council of Trent.
2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292
   In the Gregorian calendar, the tropical year is approximated as
   365 + 97 / 400 days = 365.2425 days. Thus it takes approximately 3300
   years for the tropical year to shift one day with respect to the
   Gregorian calendar.
  </para>

  <para>
   The approximation 365+97/400 is achieved by having 97 leap years
   every 400 years, using the following rules:

   <simplelist>
    <member>
2293
     Every year divisible by 4 is a leap year.
2294 2295
    </member>
    <member>
2296
     However, every year divisible by 100 is not a leap year.
2297 2298
    </member>
    <member>
2299
     However, every year divisible by 400 is a leap year after all.
2300 2301 2302 2303 2304 2305
    </member>
   </simplelist>

   So, 1700, 1800, 1900, 2100, and 2200 are not leap years. But 1600,
   2000, and 2400 are leap years.

Tom Lane's avatar
Tom Lane committed
2306 2307
   By contrast, in the older Julian calendar all years divisible by 4 are leap
   years.
2308 2309
  </para>

Bruce Momjian's avatar
Bruce Momjian committed
2310 2311 2312 2313 2314 2315 2316 2317
  <para>
   The papal bull of February 1582 decreed that 10 days should be dropped
   from October 1582 so that 15 October should follow immediately after
   4 October.
   This was observed in Italy, Poland, Portugal, and Spain. Other Catholic
   countries followed shortly after, but Protestant countries were
   reluctant to change, and the Greek orthodox countries didn't change
   until the start of the 20th century.
2318

Bruce Momjian's avatar
Bruce Momjian committed
2319 2320 2321
   The reform was observed by Great Britain and Dominions (including what is
   now the USA) in 1752.
   Thus 2 September 1752 was followed by 14 September 1752.
2322

Bruce Momjian's avatar
Bruce Momjian committed
2323 2324
   This is why Unix systems have the <command>cal</command> program
   produce the following:
2325

2326 2327
<screen>
$ <userinput>cal 9 1752</userinput>
2328 2329 2330 2331 2332
   September 1752
 S  M Tu  W Th  F  S
       1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
2333
</screen>
2334
  </para>
2335

2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346
   <note>
    <para>
     The SQL standard states that <quote>Within the definition of a
     <quote>datetime literal</quote>, the <quote>datetime
     value</quote>s are constrained by the natural rules for dates and
     times according to the Gregorian calendar</quote>.  Dates between
     1752-09-03 and 1752-09-13, although eliminated in some countries
     by Papal fiat, conform to <quote>natural rules</quote> and are
     hence valid dates.
    </para>
   </note>
2347

Bruce Momjian's avatar
Bruce Momjian committed
2348 2349 2350
  <para>
   Different calendars have been developed in various parts of the
   world, many predating the Gregorian system.
2351

Bruce Momjian's avatar
Bruce Momjian committed
2352 2353 2354 2355
   For example,
   the beginnings of the Chinese calendar can be traced back to the 14th
   century BC. Legend has it that the Emperor Huangdi invented the
   calendar in 2637 BC.
2356
   
Bruce Momjian's avatar
Bruce Momjian committed
2357 2358 2359
   The People's Republic of China uses the Gregorian calendar
   for civil purposes. The Chinese calendar is used for determining
   festivals.
2360 2361 2362
  </para>
 </sect1>
</appendix>
2363

2364 2365
<!-- Keep this comment at the end of the file
Local variables:
2366
mode:sgml
2367 2368 2369 2370 2371 2372 2373 2374 2375
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"./reference.ced"
sgml-exposed-tags:nil
2376
sgml-local-catalogs:("/usr/lib/sgml/catalog")
2377 2378 2379
sgml-local-ecat-files:nil
End:
-->