<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.52 2006/09/16 00:30:12 momjian Exp $ -->

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

  <para>
   <productname>PostgreSQL</productname> uses an internal heuristic
   parser for all date/time input support. Dates and times are input as
   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
   value, ignored, or rejected.
   The parser contains internal lookup tables for all textual fields,
   including months, days of the week, and time zones.
  </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>
   <title>Date/Time Input Interpretation</title>

   <para>
    The date/time type inputs are all decoded using the following procedure.
   </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>
        If the numeric token contains a colon (<literal>:</>), this is
        a time string. Include all subsequent digits and colons.
       </para>
      </step>

      <step>
       <para>
        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. In case of a slash
        (<literal>/</>) it can also be a full time zone name like
        <literal>America/New_York</>.
       </para>
      </step>

      <step>
       <para>
        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).
       </para>
      </step>

      <step>
       <para>
        If the token starts with a plus (<literal>+</>) or minus
        (<literal>-</>), then it is either a time zone or a special
        field.
       </para>
      </step>
     </substeps>
    </step>

    <step>
     <para>
      If the token is a text string, match up with possible strings.
     </para>
     
     <substeps>
      <step>
       <para>
        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>).
       </para>

       <para>
        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>.
       </para>
      </step>
      
      <step>
       <para>
        If not found, do a similar binary-search table lookup to match
        the token with a time zone.
       </para>
      </step>

      <step>
       <para>
        If still not found, throw an error.
       </para>
      </step>
     </substeps>
    </step>
    
    <step>
     <para>
      When the token is a number or number field:
     </para>

     <substeps>
      <step>
       <para>
        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</>.
       </para>
      </step>

      <step>
       <para>
        If the token is three digits
        and a year has already been read, then interpret as day of year.
       </para>
      </step>
      
      <step>
       <para>
        If four or six digits and a year has already been read, then
        interpret as a time (<literal>HHMM</> or <literal>HHMMSS</>).
       </para>
      </step>

      <step>
       <para>
        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).
       </para>
      </step>

      <step>
       <para>
        Otherwise the date field ordering is assumed to follow the
        <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.
       </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
      calendar, so numerically 1 BC becomes year zero.)
     </para>
    </step>

    <step>
     <para>
      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.

      <tip>
       <para>
        Gregorian years AD 1-99 may be entered by using 4 digits with leading
        zeros (e.g., <literal>0099</> is AD 99).
       </para>
      </tip>
     </para>
    </step>
   </procedure>
  </sect1>


  <sect1 id="datetime-keywords">
   <title>Date/Time Key Words</title>

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

    <table id="datetime-month-table">
     <title>Month Names</title>
     <tgroup cols="2">
      <thead>
       <row>
        <entry>Month</entry>
        <entry>Abbreviations</entry>
       </row>
      </thead>
      <tbody>
       <row>
        <entry>January</entry>
        <entry>Jan</entry>
       </row>
       <row>
        <entry>February</entry>
        <entry>Feb</entry>
       </row>
       <row>
        <entry>March</entry>
        <entry>Mar</entry>
       </row>
       <row>
        <entry>April</entry>
        <entry>Apr</entry>
       </row>
       <row>
        <entry>May</entry>
        <entry></entry>
       </row>
       <row>
        <entry>June</entry>
        <entry>Jun</entry>
       </row>
       <row>
        <entry>July</entry>
        <entry>Jul</entry>
       </row>
       <row>
        <entry>August</entry>
        <entry>Aug</entry>
       </row>
       <row>
        <entry>September</entry>
        <entry>Sep, Sept</entry>
       </row>
       <row>
        <entry>October</entry>
        <entry>Oct</entry>
       </row>
       <row>
        <entry>November</entry>
        <entry>Nov</entry>
       </row>
       <row>
        <entry>December</entry>
        <entry>Dec</entry>
       </row>
      </tbody>
     </tgroup>
    </table>

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

     <table id="datetime-dow-table">
      <title>Day of the Week Names</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Day</entry>
         <entry>Abbreviations</entry>
        </row>
       </thead>
       <tbody>
        <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>
       </tbody>
      </tgroup>
     </table>

   <para>
    <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>
     <tgroup cols="2">
      <thead>
       <row>
        <entry>Identifier</entry>
        <entry>Description</entry>
       </row>
      </thead>
      <tbody>
       <row>
        <entry><literal>ABSTIME</literal></entry>
        <entry>Ignored</entry>
       </row>
       <row>
        <entry><literal>AM</literal></entry>
        <entry>Time is before 12:00</entry>
       </row>
       <row>
        <entry><literal>AT</literal></entry>
        <entry>Ignored</entry>
       </row>
       <row>
        <entry><literal>JULIAN</>, <literal>JD</>, <literal>J</></entry>
        <entry>Next field is Julian Day</entry>
       </row>
       <row>
        <entry><literal>ON</literal></entry>
        <entry>Ignored</entry>
       </row>
       <row>
        <entry><literal>PM</literal></entry>
        <entry>Time is on or after 12:00</entry>
       </row>
       <row>
        <entry><literal>T</literal></entry>
        <entry>Next field is time</entry>
       </row>
      </tbody>
     </tgroup>
    </table>

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

   <indexterm>
    <primary>time zone</primary>
    <secondary>input abbreviations</secondary>
   </indexterm>

   <para>
    <xref linkend="datetime-timezone-input-table"> shows the time zone
    abbreviations recognized by <productname>PostgreSQL</productname>
    in date/time input values.  These abbreviations are not
    hard-wired into the server, but are obtained from a configuration
    file (see <xref linkend="datetime-config-files">).  Note that these
    names are <emphasis>not</> used for date/time output &mdash; all supported
    output formats use numeric timezone displays to avoid ambiguity.
   </para>

   <para>
    In addition to these abbreviations, the full timezone names shown in
    <xref linkend="datetime-timezone-full-names-table"> can be used
    in date/time input values.  There is a conceptual and
    practical difference between the abbreviations and the full names:
    abbreviations always represent a fixed offset from UTC, whereas most
    of the full names imply a local daylight-savings time rule and so
    have two possible UTC offsets. That's why
    you always have to specify a date if you want to use full time zone
    names in <type>timetz</> values.
   </para>

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

    <table id="datetime-timezone-input-table">
     <title>Time Zone Abbreviations for Input</title>
     <tgroup cols="3">
      <thead>
       <row>
        <entry>Time Zone</entry>
        <entry>Offset from UTC</entry>
        <entry>Description</entry>
       </row>
      </thead>
      <tbody>
       <row>
        <entry>NZDT</entry>
        <entry>+13:00</entry>
        <entry>New Zealand Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>IDLE</entry>
        <entry>+12:00</entry>
        <entry>International Date Line, East</entry>
       </row>
       <row>
        <entry>NZST</entry>
        <entry>+12:00</entry>
        <entry>New Zealand Standard Time</entry>
       </row>
       <row>
        <entry>NZT</entry>
        <entry>+12:00</entry>
        <entry>New Zealand Time</entry>
       </row>
       <row>
        <entry>AESST</entry>
        <entry>+11:00</entry>
        <entry>Australia Eastern Summer Standard Time</entry>
       </row>
       <row>
        <entry>ACSST</entry>
        <entry>+10:30</entry>
        <entry>Central Australia Summer Standard Time</entry>
       </row>
       <row>
        <entry>CADT</entry>
        <entry>+10:30</entry>
        <entry>Central Australia Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>SADT</entry>
        <entry>+10:30</entry>
        <entry>South Australian Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>AEST</entry>
        <entry>+10:00</entry>
        <entry>Australia Eastern Standard Time</entry>
       </row>
       <row>
        <entry>EAST</entry>
        <entry>+10:00</entry>
        <entry>East Australian Standard Time</entry>
       </row>
       <row>
        <entry>GST</entry>
        <entry>+10:00</entry>
        <entry>Guam Standard Time, Russia zone 9</entry>
       </row>
       <row>
        <entry>LIGT</entry>
        <entry>+10:00</entry>
        <entry>Melbourne, Australia</entry>
       </row>
       <row>
        <entry>SAST</entry>
        <entry>+09:30</entry>
        <entry>South Australia Standard Time</entry>
       </row>
       <row>
        <entry>CAST</entry>
        <entry>+09:30</entry>
        <entry>Central Australia Standard Time</entry>
       </row>
       <row>
        <entry>AWSST</entry>
        <entry>+09:00</entry>
        <entry>Australia Western Summer Standard Time</entry>
       </row>
       <row>
        <entry>JST</entry>
        <entry>+09:00</entry>
        <entry>Japan Standard Time, Russia zone 8</entry>
       </row>
       <row>
        <entry>KST</entry>
        <entry>+09:00</entry>
        <entry>Korea Standard Time</entry>
       </row>
       <row>
        <entry>MHT</entry>
        <entry>+09:00</entry>
        <entry>Kwajalein Time</entry>
       </row>
       <row>
        <entry>WDT</entry>
        <entry>+09:00</entry>
        <entry>West Australian Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>MT</entry>
        <entry>+08:30</entry>
        <entry>Moluccas Time</entry>
       </row>
       <row>
        <entry>AWST</entry>
        <entry>+08:00</entry>
        <entry>Australia Western Standard Time</entry>
       </row>
       <row>
        <entry>CCT</entry>
        <entry>+08:00</entry>
        <entry>China Coastal Time</entry>
       </row>
       <row>
        <entry>WADT</entry>
        <entry>+08:00</entry>
        <entry>West Australian Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>WST</entry>
        <entry>+08:00</entry>
        <entry>West Australian Standard Time</entry>
       </row>
       <row>
        <entry>JT</entry>
        <entry>+07:30</entry>
        <entry>Java Time</entry>
       </row>
       <row>
        <entry>ALMST</entry>
        <entry>+07:00</entry>
        <entry>Almaty Summer Time</entry>
       </row>
       <row>
        <entry>WAST</entry>
        <entry>+07:00</entry>
        <entry>West Australian Standard Time</entry>
       </row>
       <row>
        <entry>CXT</entry>
        <entry>+07:00</entry>
        <entry>Christmas (Island) Time</entry>
       </row>
       <row>
        <entry>MMT</entry>
        <entry>+06:30</entry>
        <entry>Myanmar Time</entry>
       </row>
       <row>
        <entry>ALMT</entry>
        <entry>+06:00</entry>
        <entry>Almaty Time</entry>
       </row>
       <row>
        <entry>MAWT</entry>
        <entry>+06:00</entry>
        <entry>Mawson (Antarctica) Time</entry>
       </row>
       <row>
        <entry>IOT</entry>
        <entry>+05:00</entry>
        <entry>Indian Chagos Time</entry>
       </row>
       <row>
        <entry>MVT</entry>
        <entry>+05:00</entry>
        <entry>Maldives Island Time</entry>
       </row>
       <row>
        <entry>TFT</entry>
        <entry>+05:00</entry>
        <entry>Kerguelen Time</entry>
       </row>
       <row>
        <entry>AFT</entry>
        <entry>+04:30</entry>
        <entry>Afghanistan Time</entry>
       </row>
       <row>
        <entry>EAST</entry>
        <entry>+04:00</entry>
        <entry>Antananarivo Summer Time</entry>
       </row>
       <row>
        <entry>MUT</entry>
        <entry>+04:00</entry>
        <entry>Mauritius Island Time</entry>
       </row>
       <row>
        <entry>RET</entry>
        <entry>+04:00</entry>
        <entry>Reunion Island Time</entry>
       </row>
       <row>
        <entry>SCT</entry>
        <entry>+04:00</entry>
        <entry>Mahe Island Time</entry>
       </row>
       <row>
        <entry>IRT, IT</entry>
        <entry>+03:30</entry>
        <entry>Iran Time</entry>
       </row>
       <row>
        <entry>EAT</entry>
        <entry>+03:00</entry>
        <entry>Antananarivo, Comoro Time</entry>
       </row>
       <row>
        <entry>BT</entry>
        <entry>+03:00</entry>
        <entry>Baghdad Time</entry>
       </row>
       <row>
        <entry>EETDST</entry>
        <entry>+03:00</entry>
        <entry>Eastern Europe Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>HMT</entry>
        <entry>+03:00</entry>
        <entry>Hellas Mediterranean Time (?)</entry>
       </row>
       <row>
        <entry>BDST</entry>
        <entry>+02:00</entry>
        <entry>British Double Summer Time</entry>
       </row>
       <row>
        <entry>CEST</entry>
        <entry>+02:00</entry>
        <entry>Central European Summer Time</entry>
       </row>
       <row>
        <entry>CETDST</entry>
        <entry>+02:00</entry>
        <entry>Central European Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>EET</entry>
        <entry>+02:00</entry>
        <entry>Eastern European Time, Russia zone 1</entry>
       </row>
       <row>
        <entry>FWT</entry>
        <entry>+02:00</entry>
        <entry>French Winter Time</entry>
       </row>
       <row>
        <entry>IST</entry>
        <entry>+02:00</entry>
        <entry>Israel Standard Time</entry>
       </row>
       <row>
        <entry>MEST</entry>
        <entry>+02:00</entry>
        <entry>Middle European Summer Time</entry>
       </row>
       <row>
        <entry>METDST</entry>
        <entry>+02:00</entry>
        <entry>Middle Europe Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>SST</entry>
        <entry>+02:00</entry>
        <entry>Swedish Summer Time</entry>
       </row>
       <row>
        <entry>BST</entry>
        <entry>+01:00</entry>
        <entry>British Summer Time</entry>
       </row>
       <row>
        <entry>CET</entry>
        <entry>+01:00</entry>
        <entry>Central European Time</entry>
       </row>
       <row>
        <entry>DNT</entry>
        <entry>+01:00</entry>
        <entry><foreignphrase>Dansk Normal Tid</foreignphrase></entry>
       </row>
       <row>
        <entry>FST</entry>
        <entry>+01:00</entry>
        <entry>French Summer Time</entry>
       </row>
       <row>
        <entry>MET</entry>
        <entry>+01:00</entry>
        <entry>Middle European Time</entry>
       </row>
       <row>
        <entry>MEWT</entry>
        <entry>+01:00</entry>
        <entry>Middle European Winter Time</entry>
       </row>
       <row>
        <entry>MEZ</entry>
        <entry>+01:00</entry>
        <entry><foreignphrase>Mitteleuropäische Zeit</></entry>
       </row>
       <row>
        <entry>NOR</entry>
        <entry>+01:00</entry>
        <entry>Norway Standard Time</entry>
       </row>
       <row>
        <entry>SET</entry>
        <entry>+01:00</entry>
        <entry>Seychelles Time</entry>
       </row>
       <row>
        <entry>SWT</entry>
        <entry>+01:00</entry>
        <entry>Swedish Winter Time</entry>
       </row>
       <row>
        <entry>WETDST</entry>
        <entry>+01:00</entry>
        <entry>Western European Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>GMT</entry>
        <entry>00:00</entry>
        <entry>Greenwich Mean Time</entry>
       </row>
       <row>
        <entry>UT</entry>
        <entry>00:00</entry>
        <entry>Universal Time</entry>
       </row>
       <row>
        <entry>UTC</entry>
        <entry>00:00</entry>
        <entry>Universal Coordinated Time</entry>
       </row>
       <row>
        <entry>Z</entry>
        <entry>00:00</entry>
        <entry>Same as UTC</entry>
       </row>
       <row>
        <entry>ZULU</entry>
        <entry>00:00</entry>
        <entry>Same as UTC</entry>
       </row>
       <row>
        <entry>WET</entry>
        <entry>00:00</entry>
        <entry>Western European Time</entry>
       </row>
       <row>
        <entry>WAT</entry>
        <entry>-01:00</entry>
        <entry>West Africa Time</entry>
       </row>
       <row>
        <entry>FNST</entry>
        <entry>-01:00</entry>
        <entry>Fernando de Noronha Summer Time</entry>
       </row>
       <row>
        <entry>FNT</entry>
        <entry>-02:00</entry>
        <entry>Fernando de Noronha Time</entry>
       </row>
       <row>
        <entry>BRST</entry>
        <entry>-02:00</entry>
        <entry>Brasilia Summer Time</entry>
       </row>
       <row>
        <entry>NDT</entry>
        <entry>-02:30</entry>
        <entry>Newfoundland Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>ADT</entry>
        <entry>-03:00</entry>
        <entry>Atlantic Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>AWT</entry>
        <entry>-03:00</entry>
        <entry>(unknown)</entry>
       </row>
       <row>
        <entry>BRT</entry>
        <entry>-03:00</entry>
        <entry>Brasilia Time</entry>
       </row>
       <row>
        <entry>NFT</entry>
        <entry>-03:30</entry>
        <entry>Newfoundland Standard Time</entry>
       </row>
       <row>
        <entry>NST</entry>
        <entry>-03:30</entry>
        <entry>Newfoundland Standard Time</entry>
       </row>
       <row>
        <entry>AST</entry>
        <entry>-04:00</entry>
        <entry>Atlantic Standard Time (Canada)</entry>
       </row>
       <row>
        <entry>ACST</entry>
        <entry>-04:00</entry>
        <entry>Atlantic/Porto Acre Summer Time</entry>
       </row>
       <row>
        <entry>EDT</entry>
        <entry>-04:00</entry>
        <entry>Eastern Daylight-Saving Time</entry>
       </row>
       <!--
      <row>
      <entry>ZP4</entry>
      <entry>-04:00</entry>
      <entry>GMT +4 hours</entry>
      </row>
       -->
       <row>
        <entry>ACT</entry>
        <entry>-05:00</entry>
        <entry>Atlantic/Porto Acre Standard Time</entry>
       </row>
       <row>
        <entry>CDT</entry>
        <entry>-05:00</entry>
        <entry>Central Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>EST</entry>
        <entry>-05:00</entry>
        <entry>Eastern Standard Time</entry>
       </row>
       <!--
      <row>
      <entry>ZP5</entry>
      <entry>-05:00</entry>
      <entry>GMT +5  hours</entry>
      </row>
       -->
       <row>
        <entry>CST</entry>
        <entry>-06:00</entry>
        <entry>Central Standard Time</entry>
       </row>
       <row>
        <entry>MDT</entry>
        <entry>-06:00</entry>
        <entry>Mountain Daylight-Saving Time</entry>
       </row>
       <!--
      <row>
      <entry>ZP6</entry>
      <entry>-06:00</entry>
      <entry>GMT +6  hours</entry>
      </row>
       -->
       <row>
        <entry>MST</entry>
        <entry>-07:00</entry>
        <entry>Mountain Standard Time</entry>
       </row>
       <row>
        <entry>PDT</entry>
        <entry>-07:00</entry>
        <entry>Pacific Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>AKDT</entry>
        <entry>-08:00</entry>
        <entry>Alaska Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>PST</entry>
        <entry>-08:00</entry>
        <entry>Pacific Standard Time</entry>
       </row>
       <row>
        <entry>YDT</entry>
        <entry>-08:00</entry>
        <entry>Yukon Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>AKST</entry>
        <entry>-09:00</entry>
        <entry>Alaska Standard Time</entry>
       </row>
       <row>
        <entry>HDT</entry>
        <entry>-09:00</entry>
        <entry>Hawaii/Alaska Daylight-Saving Time</entry>
       </row>
       <row>
        <entry>YST</entry>
        <entry>-09:00</entry>
        <entry>Yukon Standard Time</entry>
       </row>
       <row>
        <entry>MART</entry>
        <entry>-09:30</entry>
        <entry>Marquesas Time</entry>
       </row>
       <row>
        <entry>AHST</entry>
        <entry>-10:00</entry>
        <entry>Alaska/Hawaii Standard Time</entry>
       </row>
       <row>
        <entry>HST</entry>
        <entry>-10:00</entry>
        <entry>Hawaii Standard Time</entry>
       </row>
       <row>
        <entry>CAT</entry>
        <entry>-10:00</entry>
        <entry>Central Alaska Time</entry>
       </row>
       <row>
        <entry>NT</entry>
        <entry>-11:00</entry>
        <entry>Nome Time</entry>
       </row>
       <row>
        <entry>IDLW</entry>
        <entry>-12:00</entry>
        <entry>International Date Line, West</entry>
       </row>
      </tbody>
     </tgroup>
    </table>

   <indexterm>
    <primary>time zone</primary>
    <secondary>configuration names</secondary>
   </indexterm>

   <para>
    <xref linkend="datetime-timezone-full-names-table"> shows the time zone
    names recognized by <productname>PostgreSQL</productname> as valid
    settings for the <xref linkend="guc-timezone"> parameter.  These names
    are not hard-wired into the server, but are in fact names of configuration
    files stored under <filename>.../share/timezone/</> of the installation
    directory.
   </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-full-names-table">
     <title>Time Zone Names for setting <varname>timezone</></title>
     <tgroup cols="1">
      <thead>
       <row>
        <entry>Time Zone</entry>
       </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
    <xref linkend="guc-timezone"> values 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>

  </sect1>

  <sect1 id="datetime-config-files">
  <title>Date/Time Configuration Files</title>

   <para>
    Since timezone abbreviations are not well standardized,
    <productname>PostgreSQL</productname> provides a means to customize
    the set of abbreviations accepted by the server.  The
    <xref linkend="guc-timezone-abbreviations"> run-time parameter
    determines the active set of abbreviations.  While this parameter
    can be altered by any database user, the possible values for it
    are under the control of the database administrator &mdash; they
    are in fact names of configuration files stored in
    <filename>.../share/timezonesets/</> of the installation directory.
    By adding or altering files in that directory, the administrator
    can set local policy for timezone abbreviations.
   </para>

   <para>
    <literal>timezone_abbreviations</> can be set to any file name
    found in <filename>.../share/timezonesets/</>, if the file's name
    is entirely alphabetic.  (The prohibition against non-alphabetic
    characters in <literal>timezone_abbreviations</> prevents reading
    files outside the intended directory, as well as reading editor
    backup files and other extraneous files.)
   </para>

   <para>
    A timezone abbreviation file may contain blank lines and comments
    beginning with <literal>#</>.  Non-comment lines must have one of
    these formats:

<synopsis>
<replaceable>time_zone_name</replaceable> <replaceable>offset</replaceable>
<replaceable>time_zone_name</replaceable> <replaceable>offset</replaceable> D
@INCLUDE <replaceable>file_name</replaceable>
@OVERRIDE
</synopsis>
   </para>

   <para>
    A <replaceable>time_zone_name</replaceable> is just the abbreviation
    being defined.  The <replaceable>offset</replaceable> is the zone's
    offset in seconds from UTC, positive being east from Greenwich and
    negative being west.  For example, -18000 would be five hours west
    of Greenwich, or North American east coast standard time.  <literal>D</>
    indicates that the zone name represents local daylight-savings time
    rather than standard time.
   </para>

   <para>
    The <literal>@INCLUDE</> syntax allows inclusion of another file in the
    <filename>.../share/timezonesets/</> directory.  Inclusion can be nested,
    to a limited depth.
   </para>

   <para>
    The <literal>@OVERRIDE</> syntax indicates that subsequent entries in the
    file may override previous entries (i.e., entries obtained from included
    files).  Without this, conflicting definitions of the same timezone
    abbreviation are considered an error.
   </para>

   <para>
    In an unmodified installation, the file <filename>Default</> contains
    all the non-conflicting time zone abbreviations for most of the world.
    Additional files <filename>Australia</> and <filename>India</> are
    provided for those regions: these files first include the
    <literal>Default</> file and then add or modify timezones as needed.
   </para>

   <para>
    For reference purposes, a standard installation also contains files
    <filename>Africa.txt</>, <filename>America.txt</>, etc, containing
    information about every time zone abbreviation known to be in use
    according to the <literal>zic</> timezone database.  The zone name
    definitions found in these files can be copied and pasted into a custom
    configuration file as needed.  Note that these files cannot be directly
    referenced as <literal>timezone_abbreviations</> settings, because of
    the dot embedded in their names.
   </para>

   <caution>
    <para>
     Time zone abbreviations defined in the configuration file override
     non-timezone meanings built into <productname>PostgreSQL</productname>.
     For example, the <filename>Australia</> configuration file defines
     <literal>SAT</> (for South Australian Standard Time).  When this
     file is active, <literal>SAT</> will not be recognized as an abbreviation
     for Saturday.
    </para>
   </caution>

   <caution>
    <para>
     If you modify files in <filename>.../share/timezonesets/</>,
     it is up to you to make backups &mdash; a normal database dump
     will not include this directory.
    </para>
   </caution>

  </sect1>

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

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

   <para>
   The <quote>Julian Date</quote> is different from the <quote>Julian
   Calendar</quote>.  The Julian calendar
   was introduced by Julius Caesar in 45 BC. It was in common use
   until the year 1582, when countries started changing to the Gregorian
   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.
  </para>

  <para>   
   The accumulating calendar error prompted
   Pope Gregory XIII to reform the calendar in accordance with
   instructions from the Council of Trent.
   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>
     Every year divisible by 4 is a leap year.
    </member>
    <member>
     However, every year divisible by 100 is not a leap year.
    </member>
    <member>
     However, every year divisible by 400 is a leap year after all.
    </member>
   </simplelist>

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

   By contrast, in the older Julian calendar all years divisible by 4 are leap
   years.
  </para>

  <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.

   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.

   This is why Unix systems have the <command>cal</command> program
   produce the following:

<screen>
$ <userinput>cal 9 1752</userinput>
   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
</screen>
  </para>

   <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>

  <para>
   Different calendars have been developed in various parts of the
   world, many predating the Gregorian system.

   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.
   
   The People's Republic of China uses the Gregorian calendar
   for civil purposes. The Chinese calendar is used for determining
   festivals.
  </para>
 </sect1>
</appendix>
