head	2.60;
access;
symbols
	REL9_0_0:2.60
	REL9_1_ALPHA1:2.60
	REL9_0_RC1:2.60
	REL9_0_BETA4:2.60
	REL9_0_STABLE:2.60.0.14
	REL9_0_BETA3:2.60
	REL9_0_BETA2:2.60
	REL7_4_29:2.36.2.2
	REL8_0_25:2.45.4.1
	REL8_1_21:2.47.2.1
	REL8_2_17:2.55
	REL8_3_11:2.58
	REL8_4_4:2.60
	REL9_0_BETA1:2.60
	REL9_0_ALPHA5_BRANCH:2.60.0.12
	REL9_0_ALPHA5:2.60
	REL7_4_28:2.36.2.2
	REL8_0_24:2.45.4.1
	REL8_1_20:2.47.2.1
	REL8_2_16:2.55
	REL8_3_10:2.58
	REL8_4_3:2.60
	REL9_0_ALPHA4:2.60
	REL9_0_ALPHA4_BRANCH:2.60.0.10
	REL8_5_ALPHA3:2.60
	REL8_5_ALPHA3_BRANCH:2.60.0.8
	REL7_4_27:2.36.2.2
	REL8_0_23:2.45.4.1
	REL8_1_19:2.47.2.1
	REL8_2_15:2.55
	REL8_3_9:2.58
	REL8_4_2:2.60
	REL8_5_ALPHA2:2.60
	REL8_5_ALPHA2_BRANCH:2.60.0.6
	REL7_4_26:2.36.2.2
	REL8_0_22:2.45.4.1
	REL8_1_18:2.47.2.1
	REL8_2_14:2.55
	REL8_3_8:2.58
	REL8_4_1:2.60
	REL8_5_ALPHA1:2.60
	REL8_5_ALPHA1_BRANCH:2.60.0.4
	REL8_4_STABLE:2.60.0.2
	REL8_4_0:2.60
	REL8_4_RC2:2.60
	REL8_4_RC1:2.60
	REL8_4_BETA2:2.60
	REL8_4_BETA1:2.60
	REL7_4_25:2.36.2.2
	REL8_0_21:2.45.4.1
	REL8_1_17:2.47.2.1
	REL8_2_13:2.55
	REL8_3_7:2.58
	REL7_4_24:2.36.2.2
	REL8_0_20:2.45.4.1
	REL8_1_16:2.47.2.1
	REL8_2_12:2.55
	REL8_3_6:2.58
	REL7_4_23:2.36.2.2
	REL8_0_19:2.45.4.1
	REL8_1_15:2.47.2.1
	REL8_2_11:2.55
	REL8_3_5:2.58
	REL7_4_22:2.36.2.2
	REL8_0_18:2.45.4.1
	REL8_1_14:2.47.2.1
	REL8_2_10:2.55
	REL8_3_4:2.58
	REL7_4_21:2.36.2.2
	REL8_0_17:2.45.4.1
	REL8_1_13:2.47.2.1
	REL8_2_9:2.55
	REL8_3_3:2.58
	REL7_4_20:2.36.2.2
	REL8_0_16:2.45.4.1
	REL8_1_12:2.47.2.1
	REL8_2_8:2.55
	REL8_3_2:2.58
	REL8_2_7:2.55
	REL8_3_1:2.58
	REL8_3_STABLE:2.58.0.2
	REL8_3_0:2.58
	REL8_3_RC2:2.58
	REL7_3_21:2.28.2.1
	REL7_4_19:2.36.2.2
	REL8_0_15:2.45.4.1
	REL8_1_11:2.47.2.1
	REL8_2_6:2.55
	REL8_3_RC1:2.58
	REL8_3_BETA4:2.57
	REL8_3_BETA3:2.56
	REL8_3_BETA2:2.56
	REL8_3_BETA1:2.56
	REL7_3_20:2.28.2.1
	REL7_4_18:2.36.2.2
	REL8_0_14:2.45.4.1
	REL8_1_10:2.47.2.1
	REL8_2_5:2.55
	REL7_3_19:2.28.2.1
	REL7_4_17:2.36.2.2
	REL8_0_13:2.45.4.1
	REL8_1_9:2.47.2.1
	REL8_2_4:2.55
	REL8_0_12:2.45
	REL8_1_8:2.47
	REL8_2_3:2.55
	REL7_3_18:2.28.2.1
	REL7_4_16:2.36.2.2
	REL8_0_11:2.45
	REL8_1_7:2.47
	REL8_2_2:2.55
	REL8_0_10:2.45
	REL8_1_6:2.47
	REL8_2_1:2.55
	REL7_4_15:2.36.2.2
	REL7_3_17:2.28.2.1
	REL8_2_STABLE:2.55.0.2
	REL8_2_0:2.55
	REL8_2_RC1:2.55
	REL8_2_BETA3:2.55
	REL8_2_BETA2:2.55
	REL8_1_5:2.47
	REL8_0_9:2.45
	REL7_4_14:2.36.2.2
	REL7_3_16:2.28.2.1
	REL8_2_BETA1:2.54
	REL7_3_15:2.28.2.1
	REL7_4_13:2.36.2.2
	REL8_0_8:2.45
	REL8_1_4:2.47
	REL7_3_14:2.28.2.1
	REL7_4_12:2.36.2.2
	REL8_0_7:2.45
	REL8_1_3:2.47
	REL7_3_13:2.28.2.1
	REL7_4_11:2.36.2.2
	REL8_0_6:2.45
	REL8_1_2:2.47
	REL7_3_12:2.28.2.1
	REL7_4_10:2.36.2.2
	REL8_0_5:2.45
	REL8_1_1:2.47
	REL8_1_STABLE:2.47.0.2
	REL8_1_0:2.47
	REL8_1_0RC1:2.47
	REL8_1_0BETA4:2.47
	REL8_1_0BETA3:2.47
	REL7_3_11:2.28.2.1
	REL7_4_9:2.36.2.2
	REL8_0_4:2.45
	REL8_1_0BETA2:2.47
	REL8_1_0BETA1:2.46
	REL7_2_8:2.26
	REL7_3_10:2.28.2.1
	REL7_4_8:2.36.2.2
	REL8_0_3:2.45
	REL8_0_2:2.45
	REL7_2_7:2.26
	REL7_3_9:2.28.2.1
	REL7_4_7:2.36.2.2
	REL8_0_1:2.45
	REL8_0_STABLE:2.45.0.4
	REL8_0_0:2.45.0.2
	REL8_0_0RC5:2.45
	REL8_0_0RC4:2.44
	REL8_0_0RC3:2.44
	REL8_0_0RC2:2.43
	REL8_0_0RC1:2.43
	REL8_0_0BETA5:2.43
	REL8_0_0BETA4:2.42
	REL7_4_6:2.36.2.2
	REL7_3_8:2.28.2.1
	REL7_2_6:2.26
	REL8_0_0BETA3:2.42
	REL8_0_0BETA2:2.42
	REL7_2_5:2.26
	REL7_4_5:2.36.2.2
	REL7_3_7:2.28.2.1
	REL7_4_4:2.36.2.2
	REL8_0_0BETA1:2.41
	REL7_4_3:2.36.2.2
	REL7_4_2:2.36.2.2
	REL7_3_6:2.28.2.1
	REL7_4_1:2.36.2.2
	REL7_3_5:2.28.2.1
	REL7_4:2.36.2.1
	REL7_4_RC2:2.36.2.1
	REL7_4_STABLE:2.36.0.2
	REL7_4_RC1:2.36
	REL7_4_BETA5:2.36
	REL7_4_BETA4:2.36
	REL7_4_BETA3:2.35
	REL7_4_BETA2:2.33
	WIN32_DEV:2.32.0.2
	REL7_4_BETA1:2.32
	REL7_3_4:2.28.2.1
	REL7_3_2:2.28.2.1
	REL7_2_4:2.26
	REL7_3_STABLE:2.28.0.2
	REL7_2_3:2.26
	REL7_2_STABLE:2.26.0.2
	REL7_2:2.26
	REL7_2_RC2:2.26
	REL7_2_RC1:2.26
	REL7_2_BETA5:2.25
	REL7_2_BETA4:2.23
	REL7_2_BETA3:2.22
	REL7_2_BETA2:2.22
	REL7_2_BETA1:2.22
	REL7_1_2:2.17
	REL7_1_STABLE:2.17.0.2
	REL7_1_BETA:2.13
	REL7_1_BETA3:2.16
	REL7_1_BETA2:2.16
	REL7_1:2.17
	REL7_0_PATCHES:2.10.0.2
	REL7_0:2.10
	REL6_5_PATCHES:2.4.0.2
	REL6_5:2.4;
locks; strict;
comment	@# @;


2.60
date	2009.03.22.01.12.31;	author tgl;	state Exp;
branches;
next	2.59;

2.59
date	2008.02.16.21.51.04;	author tgl;	state Exp;
branches;
next	2.58;

2.58
date	2007.12.15.01.18.33;	author tgl;	state Exp;
branches;
next	2.57;

2.57
date	2007.12.02.22.33.20;	author tgl;	state Exp;
branches;
next	2.56;

2.56
date	2007.01.31.20.56.16;	author momjian;	state Exp;
branches;
next	2.55;

2.55
date	2006.10.17.21.03.20;	author tgl;	state Exp;
branches;
next	2.54;

2.54
date	2006.09.22.16.35.55;	author tgl;	state Exp;
branches;
next	2.53;

2.53
date	2006.09.22.16.20.00;	author tgl;	state Exp;
branches;
next	2.52;

2.52
date	2006.09.16.00.30.12;	author momjian;	state Exp;
branches;
next	2.51;

2.51
date	2006.07.25.03.51.21;	author tgl;	state Exp;
branches;
next	2.50;

2.50
date	2006.07.06.01.46.37;	author momjian;	state Exp;
branches;
next	2.49;

2.49
date	2006.04.23.03.39.50;	author momjian;	state Exp;
branches;
next	2.48;

2.48
date	2006.03.10.19.10.47;	author momjian;	state Exp;
branches;
next	2.47;

2.47
date	2005.09.09.02.31.48;	author tgl;	state Exp;
branches
	2.47.2.1;
next	2.46;

2.46
date	2005.06.15.00.34.08;	author momjian;	state Exp;
branches;
next	2.45;

2.45
date	2005.01.09.18.58.10;	author tgl;	state Exp;
branches
	2.45.4.1;
next	2.44;

2.44
date	2004.12.28.15.25.55;	author tgl;	state Exp;
branches;
next	2.43;

2.43
date	2004.11.15.06.32.13;	author neilc;	state Exp;
branches;
next	2.42;

2.42
date	2004.08.10.00.55.03;	author tgl;	state Exp;
branches;
next	2.41;

2.41
date	2004.03.31.16.20.53;	author momjian;	state Exp;
branches;
next	2.40;

2.40
date	2004.03.30.21.58.20;	author momjian;	state Exp;
branches;
next	2.39;

2.39
date	2003.12.01.20.34.53;	author tgl;	state Exp;
branches;
next	2.38;

2.38
date	2003.11.29.19.51.36;	author pgsql;	state Exp;
branches;
next	2.37;

2.37
date	2003.11.06.22.21.47;	author tgl;	state Exp;
branches;
next	2.36;

2.36
date	2003.09.20.20.12.04;	author tgl;	state Exp;
branches
	2.36.2.1;
next	2.35;

2.35
date	2003.09.11.16.22.42;	author momjian;	state Exp;
branches;
next	2.34;

2.34
date	2003.08.31.17.32.18;	author petere;	state Exp;
branches;
next	2.33;

2.33
date	2003.08.25.23.30.25;	author tgl;	state Exp;
branches;
next	2.32;

2.32
date	2003.07.29.00.03.17;	author tgl;	state Exp;
branches
	2.32.2.1;
next	2.31;

2.31
date	2003.04.07.01.29.25;	author petere;	state Exp;
branches;
next	2.30;

2.30
date	2003.03.13.01.30.27;	author petere;	state Exp;
branches;
next	2.29;

2.29
date	2002.11.11.20.14.02;	author petere;	state Exp;
branches;
next	2.28;

2.28
date	2002.08.04.06.15.45;	author thomas;	state Exp;
branches
	2.28.2.1;
next	2.27;

2.27
date	2002.03.22.19.20.07;	author petere;	state Exp;
branches;
next	2.26;

2.26
date	2002.01.20.22.19.55;	author petere;	state Exp;
branches;
next	2.25;

2.25
date	2002.01.04.17.02.25;	author thomas;	state Exp;
branches;
next	2.24;

2.24
date	2001.12.29.18.35.47;	author thomas;	state Exp;
branches;
next	2.23;

2.23
date	2001.11.21.05.53.41;	author thomas;	state Exp;
branches;
next	2.22;

2.22
date	2001.09.28.08.15.35;	author thomas;	state Exp;
branches;
next	2.21;

2.21
date	2001.09.13.15.55.22;	author petere;	state Exp;
branches;
next	2.20;

2.20
date	2001.09.09.17.21.58;	author petere;	state Exp;
branches;
next	2.19;

2.19
date	2001.06.18.19.05.11;	author tgl;	state Exp;
branches;
next	2.18;

2.18
date	2001.05.12.22.51.34;	author petere;	state Exp;
branches;
next	2.17;

2.17
date	2001.02.12.14.21.27;	author momjian;	state Exp;
branches;
next	2.16;

2.16
date	2001.01.06.11.58.55;	author petere;	state Exp;
branches;
next	2.15;

2.15
date	2000.12.22.21.51.57;	author petere;	state Exp;
branches;
next	2.14;

2.14
date	2000.12.21.22.55.27;	author petere;	state Exp;
branches;
next	2.13;

2.13
date	2000.10.20.13.57.10;	author thomas;	state Exp;
branches;
next	2.12;

2.12
date	2000.09.29.20.21.33;	author petere;	state Exp;
branches;
next	2.11;

2.11
date	2000.08.23.05.59.01;	author thomas;	state Exp;
branches;
next	2.10;

2.10
date	2000.05.02.20.36.21;	author thomas;	state Exp;
branches;
next	2.9;

2.9
date	2000.05.02.20.01.51;	author thomas;	state Exp;
branches;
next	2.8;

2.8
date	2000.03.31.03.27.40;	author thomas;	state Exp;
branches;
next	2.7;

2.7
date	2000.03.29.03.57.10;	author thomas;	state Exp;
branches;
next	2.6;

2.6
date	2000.02.02.16.21.06;	author thomas;	state Exp;
branches;
next	2.5;

2.5
date	99.10.12.13.57.04;	author thomas;	state Exp;
branches;
next	2.4;

2.4
date	99.06.23.06.17.51;	author thomas;	state Exp;
branches;
next	2.3;

2.3
date	99.05.26.17.30.28;	author thomas;	state Exp;
branches;
next	2.2;

2.2
date	99.05.22.02.27.23;	author thomas;	state Exp;
branches;
next	2.1;

2.1
date	99.05.20.05.39.25;	author thomas;	state Exp;
branches;
next	;

2.28.2.1
date	2002.11.10.12.45.41;	author petere;	state Exp;
branches;
next	;

2.32.2.1
date	2003.09.07.04.36.41;	author momjian;	state Exp;
branches;
next	;

2.36.2.1
date	2003.11.06.22.21.55;	author tgl;	state Exp;
branches;
next	2.36.2.2;

2.36.2.2
date	2003.12.01.20.35.04;	author tgl;	state Exp;
branches;
next	;

2.45.4.1
date	2007.03.14.17.38.29;	author tgl;	state Exp;
branches;
next	;

2.47.2.1
date	2007.03.14.17.38.21;	author tgl;	state Exp;
branches;
next	;


desc
@@


2.60
log
@Remove the datetime keywords ABSTIME and RELTIME, which we'd been treating as
noise words for the last twelve years, for compatibility with Berkeley-era
output formatting of the special INVALID values for those datatypes.
Considering that the datatypes themselves have been deprecated for awhile,
this is taking backwards compatibility a little far.  Per gripe from Josh
Berkus.
@
text
@<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.59 2008/02/16 21:51:04 tgl 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 can 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 id="datetime-input-rules">
   <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 might have a text month.  If a date token has
        already been seen, it is instead interpreted as a time zone
        name (e.g., <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 numeric 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 a time zone
        abbreviation.
       </para>
      </step>
      
      <step>
       <para>
        If not found, do a similar binary-search table lookup to match
        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>
      </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 can 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>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>
  </sect1>

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

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

   <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 can 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. Since all known time zone offsets are on
    15 minute boundaries, the number of seconds has to be a multiple of 900.
   </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 can 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>zoneinfo</> 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>

   <note>
    <para>
     If an error occurs while reading the time zone data sets, no new value is
     applied but the old set is kept. If the error occurs while starting the
     database, startup fails.
    </para>
   </note>

   <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 calendar was introduced by Julius Caesar in 45 BC.
   It was in common use in the Western world
   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>

  <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
   1582-10-05 and 1582-10-14, although eliminated in some countries
   by Papal fiat, conform to <quote>natural rules</quote> and are
   hence valid dates.  <productname>PostgreSQL</> follows the SQL
   standard's lead by counting dates exclusively in the Gregorian
   calendar, even for years before that calendar was in use.
  </para>

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

  <para>
   The <quote>Julian Date</quote> is unrelated to the <quote>Julian
   calendar</quote>.  
   The Julian Date system 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).
   In the Julian Date system, each day has a sequential number, starting
   from JD 0 (which is sometimes called <emphasis>the</> Julian Date).
   JD 0 corresponds to 1 January 4713 BC in the Julian calendar, or
   24 November 4714 BC in the Gregorian calendar.  Julian Date counting
   is most often used by astronomers for labeling their nightly observations,
   and therefore a date runs from noon UTC to the next noon UTC, rather than
   from midnight to midnight: JD 0 designates the 24 hours from noon UTC on
   1 January 4713 BC to noon UTC on 2 January 4713 BC.
  </para>

  <para>
   Although <productname>PostgreSQL</> supports Julian Date notation for
   input and output of dates (and also uses them for some internal datetime
   calculations), it does not observe the nicety of having dates run from
   noon to noon.  <productname>PostgreSQL</> treats a Julian Date as running
   from midnight to midnight.
  </para>

 </sect1>
</appendix>
@


2.59
log
@Update docs to reflect the fact that we can now deal with DST rules
outside the 32-bit-time_t range.  Also, refer to Olson's tz database
as the 'zoneinfo' database, a name that upstream sometimes uses, not
'zic database' which they never use.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.58 2007/12/15 01:18:33 tgl Exp $ -->
a311 4
        <entry><literal>ABSTIME</literal></entry>
        <entry>Ignored</entry>
       </row>
       <row>
a337 9

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


2.58
log
@Improve documentation about Julian dates; in particular, point out the
difference between Julian and Gregorian reckoning of when JD 0 was.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.57 2007/12/02 22:33:20 tgl Exp $ -->
d433 1
a433 1
    according to the <literal>zic</> timezone database.  The zone name
@


2.57
log
@Ensure that all <sect1> and <refentry> tags have IDs.  This is needed
to ensure that the resulting webpages have predictable URLs, instead of
ever-changing numeric IDs.  The new contrib docs were the biggest
offender, but some old stuff had the problem too.  Also, rename a couple
of new contrib sgml files for consistency's sake.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.56 2007/01/31 20:56:16 momjian Exp $ -->
d473 2
a474 14
   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
d520 1
a520 1
   reluctant to change, and the Greek orthodox countries didn't change
d540 11
a550 11
   <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>
d558 1
a558 1
   century BC. Legend has it that the Emperor Huangdi invented the
d565 26
@


2.56
log
@Update documentation on may/can/might:

Standard English uses "may", "can", and "might" in different ways:

        may - permission, "You may borrow my rake."

        can - ability, "I can lift that log."

        might - possibility, "It might rain today."

Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice.  Similarly, "It may crash" is better stated, "It might crash".

Also update two error messages mentioned in the documenation to match.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.55 2006/10/17 21:03:20 tgl Exp $ -->
d23 1
a23 1
  <sect1>
@


2.55
log
@Fix up some problems in handling of zic-style time zone names in datetime
input routines.  Remove the former "DecodePosixTimezone" function in favor of
letting the zic code handle POSIX-style zone specs (see tzparse()).  In
particular this means that "PST+3" now means the same as "-03", whereas it
used to mean "-11" --- the zone abbreviation is effectively just a noise word
in this syntax.  Make sure that all named and POSIX-style zone names will be
parsed as a single token.  Fix long-standing bogosities in printing and input
of fractional-hour timezone offsets (since the tzparse() code will accept
these, we'd better make 'em work).  Also correct an error in the original
coding of the zic-zone-name patch: in "timestamp without time zone" input,
zone names are supposed to be allowed but ignored, but the coding was such
that the zone changed the interpretation anyway.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.54 2006/09/22 16:35:55 tgl Exp $ -->
d10 1
a10 1
   determination of what kind of information may be in the
d49 1
a49 1
        a date string which may have a text month.  If a date token has
d169 1
a169 1
        Gregorian years AD 1-99 may be entered by using 4 digits with leading
d385 1
a385 1
    A timezone abbreviation file may contain blank lines and comments
d416 1
a416 1
    file may override previous entries (i.e., entries obtained from included
@


2.54
log
@Move incorrectly-located indexterm entry.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.53 2006/09/22 16:20:00 tgl Exp $ -->
d49 3
a51 3
        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</>.
d67 1
a67 1
        (<literal>-</>), then it is either a time zone or a special
d76 1
a76 1
      If the token is a text string, match up with possible strings.
d82 2
a83 11
        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>.
d90 4
a93 1
        the token with a time zone.
@


2.53
log
@Update timezone documentation to reflect current reality: instead of
giving tables of known timezone names, refer the user to the system views.
Joachim Wieland
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.52 2006/09/16 00:30:12 momjian Exp $ -->
d357 4
a365 4
  </sect1>

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


2.52
log
@Remove emacs info from footer of SGML files.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.51 2006/07/25 03:51:21 tgl Exp $ -->
a361 1842

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

d410 2
a411 1
    rather than standard time.
d446 8
@


2.51
log
@Remove hard-wired lists of timezone abbreviations in favor of providing
configuration files that can be altered by a DBA.  The australian_timezones
GUC setting disappears, replaced by a timezone_abbreviations setting (set this
to 'Australia' to get the effect of australian_timezones).  The list of zone
names defined by default has undergone a bit of cleanup, too.  Documentation
still needs some work --- in particular, should we fix Table B-4, or just get
rid of it?  Joachim Wieland, with some editorializing by moi.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.50 2006/07/06 01:46:37 momjian Exp $ -->
a2417 17

<!-- Keep this comment at the end of the file
Local variables:
mode:sgml
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
sgml-local-catalogs:("/usr/lib/sgml/catalog")
sgml-local-ecat-files:nil
End:
-->
@


2.50
log
@Please find attached two patches for documentation and regression tests
for the usage of full time zone names.

Joachim Wieland
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.49 2006/04/23 03:39:50 momjian Exp $ -->
d364 1
a364 2
    <xref linkend="datetime-timezone-input-table"> and
    <xref linkend="datetime-timezone-full-names-table"> show the time zone
d366 17
a382 6
    in date/time input values.  Note that these names are <emphasis>not</>
    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
    likely that future releases will make some use of <varname>timezone</>
    for input as well.)
a937 55
  <formalpara>
   <title>Australian Time Zones</title>

   <para>
    There are three naming conflicts between Australian time zone
    names and time zone names commonly used in North and South America:
    <literal>ACST</literal>, <literal>CST</literal>, and
    <literal>EST</literal>.  If the run-time option
    <varname>australian_timezones</varname> is set to true then
    <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.
   </para>
  </formalpara>

    <table id="datetime-oztz-table">
     <title>Australian 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>ACST</entry>
        <entry>+09:30</entry>
        <entry>Central Australia Standard Time</entry>
       </row>
       <row>
        <entry>CST</entry>
        <entry>+10:30</entry>
        <entry>Australian Central Standard Time</entry>
       </row>
       <row>
        <entry>EST</entry>
        <entry>+10:00</entry>
        <entry>Australian Eastern Standard Time</entry>
       </row>
       <row>
        <entry>SAT</entry>
        <entry>+09:30</entry>
        <entry>South Australian Standard Time</entry>
       </row>
      </tbody>
     </tgroup>
    </table>

d946 4
a949 7
    settings for the <xref linkend="guc-timezone"> parameter.  Note that
    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. That's why
    you always have to specify a date if you want to use these time zone
    names in <type>timetz</> values.
d959 1
a959 1
     <title>Time Zone Names for date/time input values and for setting <varname>timezone</></title>
d2185 2
a2186 1
    <productname>PostgreSQL</productname> will accept time zone names of the
d2206 102
@


2.49
log
@Removes or minimizes some documentation mentions of backward
compatibility for release 7.2 and earlier.  I have not altered any
mentions of release 7.3 or later.  The release notes were not modified,
so the changes are still documented, just not in the main docs.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.48 2006/03/10 19:10:47 momjian Exp $ -->
d49 3
a51 1
        a date string which may have a text month.
d364 2
a365 1
    <xref linkend="datetime-timezone-input-table"> shows the time zone
d989 1
a989 1
    <xref linkend="datetime-timezone-set-table"> shows the time zone
d995 3
a997 1
    the former names each represent just a fixed offset from UTC.
d1006 2
a1007 2
    <table id="datetime-timezone-set-table">
     <title>Time Zone Names for Setting <varname>timezone</></title>
@


2.48
log
@Make $PostgreSQL CVS tags consistent for SGML files.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/advanced.sgml,v 1.49 2005/04/09 03:52:43 momjian Exp $ -->
d174 1
a174 4
        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.
@


2.47
log
@Fix the various forms of AT TIME ZONE to accept either timezones found
in the zic database or zone names found in the date token table.  This
preserves the old ability to do AT TIME ZONE 'PST' along with the new
ability to do AT TIME ZONE 'PST8PDT'.  Per gripe from Bricklen Anderson.
Also, fix some inconsistencies in usage of TZ_STRLEN_MAX --- the old
code had the potential for one-byte buffer overruns, though given
alignment considerations it's unlikely there was any real risk.
@
text
@d1 1
a1 3
<!--
$PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.46 2005/06/15 00:34:08 momjian Exp $
-->
@


2.47.2.1
log
@Arrange to install a "posixrules" entry in our timezone database, so that
POSIX-style timezone specs that don't exactly match any database entry will
be treated as having correct USA DST rules.  Also, document that this can
be changed if you want to use some other DST rules with a POSIX zone spec.

We could consider changing localtime.c's TZDEFRULESTRING, but since that
facility can only deal with one DST transition rule, it seems fairly useless
now; might as well just plan to override it using a "posixrules" entry.

Backpatch as far as 8.0.  There isn't much we can do in 7.x ... either your
libc gets it right, or it doesn't.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.47 2005/09/09 02:31:48 tgl Exp $
d2233 2
a2234 2
    <productname>PostgreSQL</productname> will accept POSIX-style time zone
    specifications of the form <replaceable>STD</><replaceable>offset</> or
d2238 11
a2248 12
    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 the same daylight-savings transition rules used in the
    <literal>zic</> time zone database's <filename>posixrules</> entry.
    In a standard <productname>PostgreSQL</productname> installation,
    <filename>posixrules</> is the same as <literal>US/Eastern</>, so
    that POSIX-style time zone specifications follow USA daylight-savings
    rules.  If needed, you can adjust this behavior by replacing the
    <filename>posixrules</> file.
a2250 8
    <para>
     One should be wary that the POSIX-style time zone feature 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 UTC.
    </para>

@


2.46
log
@This patch makes it possible to use the full set of timezones when doing
"AT TIME ZONE", and not just the shorlist previously available. For
example:

SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';

works fine now. It will also obey whatever DST rules were in effect at
just that date, which the previous implementation did not.

It also supports the AT TIME ZONE on the timetz datatype. The whole
handling of DST is a bit bogus there, so I chose to make it use whatever
DST rules are in effect at the time of executig the query. not sure if
anybody is actuallyi *using* timetz though, it seems pretty
unpredictable just because of this...

Magnus Hagander
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.45 2005/01/09 18:58:10 tgl Exp $
d993 1
a993 3
    settings for the <xref linkend="guc-timezone"> parameter, and as
	parameters to the <literal>AT TIME ZONE function</> (see 
	<xref linkend="functions-datetime-zoneconvert">).  Note that
d1007 1
a1007 1
     <title>Time Zone Names for Setting <varname>timezone</> and <literal>AT TIME ZONE</></title>
@


2.45
log
@Last batch of updates in response to 7.4 interactive docs comments.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.44 2004/12/28 15:25:55 tgl Exp $
d993 3
a995 1
    settings for the <xref linkend="guc-timezone"> parameter.  Note that
d1009 1
a1009 1
     <title>Time Zone Names for Setting <varname>timezone</></title>
@


2.45.4.1
log
@Arrange to install a "posixrules" entry in our timezone database, so that
POSIX-style timezone specs that don't exactly match any database entry will
be treated as having correct USA DST rules.  Also, document that this can
be changed if you want to use some other DST rules with a POSIX zone spec.

We could consider changing localtime.c's TZDEFRULESTRING, but since that
facility can only deal with one DST transition rule, it seems fairly useless
now; might as well just plan to override it using a "posixrules" entry.

Backpatch as far as 8.0.  There isn't much we can do in 7.x ... either your
libc gets it right, or it doesn't.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.45 2005/01/09 18:58:10 tgl Exp $
d2233 2
a2234 2
    <productname>PostgreSQL</productname> will accept POSIX-style time zone
    specifications of the form <replaceable>STD</><replaceable>offset</> or
d2238 11
a2248 12
    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 the same daylight-savings transition rules used in the
    <literal>zic</> time zone database's <filename>posixrules</> entry.
    In a standard <productname>PostgreSQL</productname> installation,
    <filename>posixrules</> is the same as <literal>US/Eastern</>, so
    that POSIX-style time zone specifications follow USA daylight-savings
    rules.  If needed, you can adjust this behavior by replacing the
    <filename>posixrules</> file.
a2250 8
    <para>
     One should be wary that the POSIX-style time zone feature 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 UTC.
    </para>

@


2.44
log
@BDST should be "British double SUMMER time", not Standard time.
Per John Smith.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.43 2004/11/15 06:32:13 neilc Exp $
d42 2
a43 2
	If the numeric token contains a colon (<literal>:</>), this is
	a time string. Include all subsequent digits and colons.
d49 3
a51 3
	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.
d57 4
a60 4
	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).
d66 3
a68 3
	If the token starts with a plus (<literal>+</>) or minus
	(<literal>-</>), then it is either a time zone or a special
	field.
d82 5
a86 5
	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>).
d90 3
a92 3
	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>.
d98 2
a99 2
	If not found, do a similar binary-search table lookup to match
	the token with a time zone.
d105 1
a105 1
	If still not found, throw an error.
d119 5
a123 5
	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</>.
d129 2
a130 2
	If the token is three digits
	and a year has already been read, then interpret as day of year.
d136 2
a137 2
	If four or six digits and a year has already been read, then
	interpret as a time (<literal>HHMM</> or <literal>HHMMSS</>).
d143 3
a145 3
	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).
d152 2
a153 2
	<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.
d175 5
a179 5
	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.
d193 1
a193 1
    permissible as abbreviations for the names of the month.
d197 1
a197 1
     <title>Month Abbreviations</title>
d201 2
a202 2
	<entry>Month</entry>
	<entry>Abbreviations</entry>
d207 2
a208 2
	<entry>April</entry>
	<entry>Apr</entry>
d211 2
a212 2
	<entry>August</entry>
	<entry>Aug</entry>
d215 2
a216 2
	<entry>December</entry>
	<entry>Dec</entry>
d219 2
a220 2
	<entry>February</entry>
	<entry>Feb</entry>
d223 2
a224 2
	<entry>January</entry>
	<entry>Jan</entry>
d227 2
a228 2
	<entry>July</entry>
	<entry>Jul</entry>
d231 2
a232 2
	<entry>June</entry>
	<entry>Jun</entry>
d235 2
a236 2
	<entry>March</entry>
	<entry>Mar</entry>
d239 2
a240 2
	<entry>November</entry>
	<entry>Nov</entry>
d243 2
a244 2
	<entry>October</entry>
	<entry>Oct</entry>
d247 6
a252 2
	<entry>September</entry>
	<entry>Sep, Sept</entry>
a257 6
    <note>
     <para>
      The month May has no explicit abbreviation, for obvious reasons.
     </para>
    </note>

d260 1
a260 2
     permissible as abbreviations for the names of the days of the
     week.
d264 1
a264 1
      <title>Day of the Week Abbreviations</title>
d267 4
a270 4
	<row>
	 <entry>Day</entry>
	 <entry>Abbreviation</entry>
	</row>
d273 28
a300 28
	<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>
d315 2
a316 2
	<entry>Identifier</entry>
	<entry>Description</entry>
d321 2
a322 2
	<entry><literal>ABSTIME</literal></entry>
	<entry>Key word ignored</entry>
d325 2
a326 2
	<entry><literal>AM</literal></entry>
	<entry>Time is before 12:00</entry>
d329 2
a330 2
	<entry><literal>AT</literal></entry>
	<entry>Key word ignored</entry>
d333 2
a334 2
	<entry><literal>JULIAN</>, <literal>JD</>, <literal>J</></entry>
	<entry>Next field is Julian Day</entry>
d337 2
a338 2
	<entry><literal>ON</literal></entry>
	<entry>Key word ignored</entry>
d341 2
a342 2
	<entry><literal>PM</literal></entry>
	<entry>Time is on or after 12:00</entry>
d345 2
a346 2
	<entry><literal>T</literal></entry>
	<entry>Next field is time</entry>
d370 3
a372 2
    used for date/time output &mdash; display is driven by the currently
    selected <xref linkend="guc-timezone"> parameter setting.  (It is
d389 3
a391 3
	<entry>Time Zone</entry>
	<entry>Offset from UTC</entry>
	<entry>Description</entry>
d396 3
a398 3
	<entry>NZDT</entry>
	<entry>+13:00</entry>
	<entry>New Zealand Daylight-Saving Time</entry>
d401 3
a403 3
	<entry>IDLE</entry>
	<entry>+12:00</entry>
	<entry>International Date Line, East</entry>
d406 3
a408 3
	<entry>NZST</entry>
	<entry>+12:00</entry>
	<entry>New Zealand Standard Time</entry>
d411 3
a413 3
	<entry>NZT</entry>
	<entry>+12:00</entry>
	<entry>New Zealand Time</entry>
d416 3
a418 3
	<entry>AESST</entry>
	<entry>+11:00</entry>
	<entry>Australia Eastern Summer Standard Time</entry>
d421 3
a423 3
	<entry>ACSST</entry>
	<entry>+10:30</entry>
	<entry>Central Australia Summer Standard Time</entry>
d426 3
a428 3
	<entry>CADT</entry>
	<entry>+10:30</entry>
	<entry>Central Australia Daylight-Saving Time</entry>
d431 3
a433 3
	<entry>SADT</entry>
	<entry>+10:30</entry>
	<entry>South Australian Daylight-Saving Time</entry>
d436 3
a438 3
	<entry>AEST</entry>
	<entry>+10:00</entry>
	<entry>Australia Eastern Standard Time</entry>
d441 3
a443 3
	<entry>EAST</entry>
	<entry>+10:00</entry>
	<entry>East Australian Standard Time</entry>
d446 3
a448 3
	<entry>GST</entry>
	<entry>+10:00</entry>
	<entry>Guam Standard Time, Russia zone 9</entry>
d451 3
a453 3
	<entry>LIGT</entry>
	<entry>+10:00</entry>
	<entry>Melbourne, Australia</entry>
d456 3
a458 3
	<entry>SAST</entry>
	<entry>+09:30</entry>
	<entry>South Australia Standard Time</entry>
d461 3
a463 3
	<entry>CAST</entry>
	<entry>+09:30</entry>
	<entry>Central Australia Standard Time</entry>
d466 3
a468 3
	<entry>AWSST</entry>
	<entry>+09:00</entry>
	<entry>Australia Western Summer Standard Time</entry>
d471 3
a473 3
	<entry>JST</entry>
	<entry>+09:00</entry>
	<entry>Japan Standard Time, Russia zone 8</entry>
d476 3
a478 3
	<entry>KST</entry>
	<entry>+09:00</entry>
	<entry>Korea Standard Time</entry>
d481 3
a483 3
	<entry>MHT</entry>
	<entry>+09:00</entry>
	<entry>Kwajalein Time</entry>
d486 3
a488 3
	<entry>WDT</entry>
	<entry>+09:00</entry>
	<entry>West Australian Daylight-Saving Time</entry>
d491 3
a493 3
	<entry>MT</entry>
	<entry>+08:30</entry>
	<entry>Moluccas Time</entry>
d496 3
a498 3
	<entry>AWST</entry>
	<entry>+08:00</entry>
	<entry>Australia Western Standard Time</entry>
d501 3
a503 3
	<entry>CCT</entry>
	<entry>+08:00</entry>
	<entry>China Coastal Time</entry>
d506 3
a508 3
	<entry>WADT</entry>
	<entry>+08:00</entry>
	<entry>West Australian Daylight-Saving Time</entry>
d511 3
a513 3
	<entry>WST</entry>
	<entry>+08:00</entry>
	<entry>West Australian Standard Time</entry>
d516 3
a518 3
	<entry>JT</entry>
	<entry>+07:30</entry>
	<entry>Java Time</entry>
d521 3
a523 3
	<entry>ALMST</entry>
	<entry>+07:00</entry>
	<entry>Almaty Summer Time</entry>
d526 3
a528 3
	<entry>WAST</entry>
	<entry>+07:00</entry>
	<entry>West Australian Standard Time</entry>
d531 3
a533 3
	<entry>CXT</entry>
	<entry>+07:00</entry>
	<entry>Christmas (Island) Time</entry>
d536 3
a538 3
	<entry>MMT</entry>
	<entry>+06:30</entry>
	<entry>Myanmar Time</entry>
d541 3
a543 3
	<entry>ALMT</entry>
	<entry>+06:00</entry>
	<entry>Almaty Time</entry>
d546 3
a548 3
	<entry>MAWT</entry>
	<entry>+06:00</entry>
	<entry>Mawson (Antarctica) Time</entry>
d551 3
a553 3
	<entry>IOT</entry>
	<entry>+05:00</entry>
	<entry>Indian Chagos Time</entry>
d556 3
a558 3
	<entry>MVT</entry>
	<entry>+05:00</entry>
	<entry>Maldives Island Time</entry>
d561 3
a563 3
	<entry>TFT</entry>
	<entry>+05:00</entry>
	<entry>Kerguelen Time</entry>
d566 3
a568 3
	<entry>AFT</entry>
	<entry>+04:30</entry>
	<entry>Afghanistan Time</entry>
d571 3
a573 3
	<entry>EAST</entry>
	<entry>+04:00</entry>
	<entry>Antananarivo Summer Time</entry>
d576 3
a578 3
	<entry>MUT</entry>
	<entry>+04:00</entry>
	<entry>Mauritius Island Time</entry>
d581 3
a583 3
	<entry>RET</entry>
	<entry>+04:00</entry>
	<entry>Reunion Island Time</entry>
d586 3
a588 3
	<entry>SCT</entry>
	<entry>+04:00</entry>
	<entry>Mahe Island Time</entry>
d591 3
a593 3
	<entry>IRT, IT</entry>
	<entry>+03:30</entry>
	<entry>Iran Time</entry>
d596 3
a598 3
	<entry>EAT</entry>
	<entry>+03:00</entry>
	<entry>Antananarivo, Comoro Time</entry>
d601 3
a603 3
	<entry>BT</entry>
	<entry>+03:00</entry>
	<entry>Baghdad Time</entry>
d606 3
a608 3
	<entry>EETDST</entry>
	<entry>+03:00</entry>
	<entry>Eastern Europe Daylight-Saving Time</entry>
d611 3
a613 3
	<entry>HMT</entry>
	<entry>+03:00</entry>
	<entry>Hellas Mediterranean Time (?)</entry>
d616 3
a618 3
	<entry>BDST</entry>
	<entry>+02:00</entry>
	<entry>British Double Summer Time</entry>
d621 3
a623 3
	<entry>CEST</entry>
	<entry>+02:00</entry>
	<entry>Central European Summer Time</entry>
d626 3
a628 3
	<entry>CETDST</entry>
	<entry>+02:00</entry>
	<entry>Central European Daylight-Saving Time</entry>
d631 3
a633 3
	<entry>EET</entry>
	<entry>+02:00</entry>
	<entry>Eastern European Time, Russia zone 1</entry>
d636 3
a638 3
	<entry>FWT</entry>
	<entry>+02:00</entry>
	<entry>French Winter Time</entry>
d641 3
a643 3
	<entry>IST</entry>
	<entry>+02:00</entry>
	<entry>Israel Standard Time</entry>
d646 3
a648 3
	<entry>MEST</entry>
	<entry>+02:00</entry>
	<entry>Middle European Summer Time</entry>
d651 3
a653 3
	<entry>METDST</entry>
	<entry>+02:00</entry>
	<entry>Middle Europe Daylight-Saving Time</entry>
d656 3
a658 3
	<entry>SST</entry>
	<entry>+02:00</entry>
	<entry>Swedish Summer Time</entry>
d661 3
a663 3
	<entry>BST</entry>
	<entry>+01:00</entry>
	<entry>British Summer Time</entry>
d666 3
a668 3
	<entry>CET</entry>
	<entry>+01:00</entry>
	<entry>Central European Time</entry>
d671 3
a673 3
	<entry>DNT</entry>
	<entry>+01:00</entry>
	<entry><foreignphrase>Dansk Normal Tid</foreignphrase></entry>
d676 3
a678 3
	<entry>FST</entry>
	<entry>+01:00</entry>
	<entry>French Summer Time</entry>
d681 3
a683 3
	<entry>MET</entry>
	<entry>+01:00</entry>
	<entry>Middle European Time</entry>
d686 3
a688 3
	<entry>MEWT</entry>
	<entry>+01:00</entry>
	<entry>Middle European Winter Time</entry>
d691 3
a693 3
	<entry>MEZ</entry>
	<entry>+01:00</entry>
	<entry><foreignphrase>Mitteleuropäische Zeit</></entry>
d696 3
a698 3
	<entry>NOR</entry>
	<entry>+01:00</entry>
	<entry>Norway Standard Time</entry>
d701 3
a703 3
	<entry>SET</entry>
	<entry>+01:00</entry>
	<entry>Seychelles Time</entry>
d706 3
a708 3
	<entry>SWT</entry>
	<entry>+01:00</entry>
	<entry>Swedish Winter Time</entry>
d711 3
a713 3
	<entry>WETDST</entry>
	<entry>+01:00</entry>
	<entry>Western European Daylight-Saving Time</entry>
d716 3
a718 3
	<entry>GMT</entry>
	<entry>00:00</entry>
	<entry>Greenwich Mean Time</entry>
d721 3
a723 3
	<entry>UT</entry>
	<entry>00:00</entry>
	<entry>Universal Time</entry>
d726 3
a728 3
	<entry>UTC</entry>
	<entry>00:00</entry>
	<entry>Universal Coordinated Time</entry>
d731 3
a733 3
	<entry>Z</entry>
	<entry>00:00</entry>
	<entry>Same as UTC</entry>
d736 3
a738 3
	<entry>ZULU</entry>
	<entry>00:00</entry>
	<entry>Same as UTC</entry>
d741 3
a743 3
	<entry>WET</entry>
	<entry>00:00</entry>
	<entry>Western European Time</entry>
d746 3
a748 3
	<entry>WAT</entry>
	<entry>-01:00</entry>
	<entry>West Africa Time</entry>
d751 3
a753 3
	<entry>FNST</entry>
	<entry>-01:00</entry>
	<entry>Fernando de Noronha Summer Time</entry>
d756 3
a758 3
	<entry>FNT</entry>
	<entry>-02:00</entry>
	<entry>Fernando de Noronha Time</entry>
d761 3
a763 3
	<entry>BRST</entry>
	<entry>-02:00</entry>
	<entry>Brasilia Summer Time</entry>
d766 3
a768 3
	<entry>NDT</entry>
	<entry>-02:30</entry>
	<entry>Newfoundland Daylight-Saving Time</entry>
d771 3
a773 3
	<entry>ADT</entry>
	<entry>-03:00</entry>
	<entry>Atlantic Daylight-Saving Time</entry>
d776 3
a778 3
	<entry>AWT</entry>
	<entry>-03:00</entry>
	<entry>(unknown)</entry>
d781 3
a783 3
	<entry>BRT</entry>
	<entry>-03:00</entry>
	<entry>Brasilia Time</entry>
d786 3
a788 3
	<entry>NFT</entry>
	<entry>-03:30</entry>
	<entry>Newfoundland Standard Time</entry>
d791 3
a793 3
	<entry>NST</entry>
	<entry>-03:30</entry>
	<entry>Newfoundland Standard Time</entry>
d796 3
a798 3
	<entry>AST</entry>
	<entry>-04:00</entry>
	<entry>Atlantic Standard Time (Canada)</entry>
d801 3
a803 3
	<entry>ACST</entry>
	<entry>-04:00</entry>
	<entry>Atlantic/Porto Acre Summer Time</entry>
d806 3
a808 3
	<entry>EDT</entry>
	<entry>-04:00</entry>
	<entry>Eastern Daylight-Saving Time</entry>
d818 3
a820 3
	<entry>ACT</entry>
	<entry>-05:00</entry>
	<entry>Atlantic/Porto Acre Standard Time</entry>
d823 3
a825 3
	<entry>CDT</entry>
	<entry>-05:00</entry>
	<entry>Central Daylight-Saving Time</entry>
d828 3
a830 3
	<entry>EST</entry>
	<entry>-05:00</entry>
	<entry>Eastern Standard Time</entry>
d840 3
a842 3
	<entry>CST</entry>
	<entry>-06:00</entry>
	<entry>Central Standard Time</entry>
d845 3
a847 3
	<entry>MDT</entry>
	<entry>-06:00</entry>
	<entry>Mountain Daylight-Saving Time</entry>
d857 3
a859 3
	<entry>MST</entry>
	<entry>-07:00</entry>
	<entry>Mountain Standard Time</entry>
d862 3
a864 3
	<entry>PDT</entry>
	<entry>-07:00</entry>
	<entry>Pacific Daylight-Saving Time</entry>
d867 3
a869 3
	<entry>AKDT</entry>
	<entry>-08:00</entry>
	<entry>Alaska Daylight-Saving Time</entry>
d872 3
a874 3
	<entry>PST</entry>
	<entry>-08:00</entry>
	<entry>Pacific Standard Time</entry>
d877 3
a879 3
	<entry>YDT</entry>
	<entry>-08:00</entry>
	<entry>Yukon Daylight-Saving Time</entry>
d882 3
a884 3
	<entry>AKST</entry>
	<entry>-09:00</entry>
	<entry>Alaska Standard Time</entry>
d887 3
a889 3
	<entry>HDT</entry>
	<entry>-09:00</entry>
	<entry>Hawaii/Alaska Daylight-Saving Time</entry>
d892 3
a894 3
	<entry>YST</entry>
	<entry>-09:00</entry>
	<entry>Yukon Standard Time</entry>
d897 3
a899 3
	<entry>MART</entry>
	<entry>-09:30</entry>
	<entry>Marquesas Time</entry>
d902 3
a904 3
	<entry>AHST</entry>
	<entry>-10:00</entry>
	<entry>Alaska/Hawaii Standard Time</entry>
d907 3
a909 3
	<entry>HST</entry>
	<entry>-10:00</entry>
	<entry>Hawaii Standard Time</entry>
d912 3
a914 3
	<entry>CAT</entry>
	<entry>-10:00</entry>
	<entry>Central Alaska Time</entry>
d917 3
a919 3
	<entry>NT</entry>
	<entry>-11:00</entry>
	<entry>Nome Time</entry>
d922 3
a924 3
	<entry>IDLW</entry>
	<entry>-12:00</entry>
	<entry>International Date Line, West</entry>
d955 3
a957 3
	<entry>Time Zone</entry>
	<entry>Offset from UTC</entry>
	<entry>Description</entry>
d962 3
a964 3
	<entry>ACST</entry>
	<entry>+09:30</entry>
	<entry>Central Australia Standard Time</entry>
d967 3
a969 3
	<entry>CST</entry>
	<entry>+10:30</entry>
	<entry>Australian Central Standard Time</entry>
d972 3
a974 3
	<entry>EST</entry>
	<entry>+10:00</entry>
	<entry>Australian Eastern Standard Time</entry>
d977 3
a979 3
	<entry>SAT</entry>
	<entry>+09:30</entry>
	<entry>South Australian Standard Time</entry>
d1011 1
a1011 1
	<entry>Time Zone</entry>
@


2.43
log
@Replace "--" and "---" with "&mdash;" as appropriate, for better-looking
output.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.42 2004/08/10 00:55:03 tgl Exp $
d620 1
a620 1
	<entry>British Double Standard Time</entry>
@


2.42
log
@Update documentation to reflect the fact that we now know exactly what
time zone names we support.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/datetime.sgml,v 2.41 2004/03/31 16:20:53 momjian Exp $
d373 1
a373 1
    used for date/time output --- display is driven by the currently
@


2.41
log
@Back out tutorial changes:

---------------------------------------------------------------------------

1.  In keeping with the recent discussion that there should be more
said about views, stored procedures, and triggers, in the tutorial, I
have added a bit of verbiage to that end.

2.  Some formatting changes to the datetime discussion, as well as
addition of a citation of a relevant book on calendars.

Christopher Browne
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/datetime.sgml,v 2.39 2003/12/01 20:34:53 tgl Exp $
d16 1
a16 2
   including months, days of the week, and time
   zones.
d163 1
a163 2
      calendar, so numerically 1 BC becomes year
      zero.)
d169 3
a171 3
      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.
d366 1
a366 1
    <secondary>abbreviations</secondary>
d370 1
a370 1
    <xref linkend="datetime-timezone-table"> shows the time zone
d372 5
a376 16
    in date/time input values.
    <productname>PostgreSQL</productname> uses internal tables
    for time zone input decoding, since there is no standard
    operating system interface to provide access to general,
    cross-time zone information. The underlying operating system
    <emphasis>is</emphasis> used to provide time zone information for
    <emphasis>output</emphasis>, however.
   </para>

   <para>
    Keep in mind also that the time zone names
    recognized by <command>SET TIMEZONE</> are operating-system
    dependent and may have little to do with <xref
    linkend="datetime-timezone-table">.  For example, some systems
    recognize values like <literal>'Europe/Rome'</> in <command>SET
    TIMEZONE</>.
d386 2
a387 2
    <table id="datetime-timezone-table">
     <title>Time Zone Abbreviations</title>
d953 1
a953 1
     <title>Australian Time Zone Abbreviations</title>
d987 1266
@


2.40
log
@1.  In keeping with the recent discussion that there should be more
said about views, stored procedures, and triggers, in the tutorial, I
have added a bit of verbiage to that end.

2.  Some formatting changes to the datetime discussion, as well as
addition of a citation of a relevant book on calendars.

Christopher Browne
@
text
@d14 2
a15 2
   value, ignored, or rejected.</para>
   <para> The parser contains internal lookup tables for all textual fields,
d1059 12
a1070 12
  <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.</para>
  
  <para> 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.</para>

  <para> 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.</para>
d1072 2
a1073 2
   <para> This is why Unix systems have the <command>cal</command>
   program produce the following:
d1097 3
a1099 2
  <para> Different calendars have been developed in various parts of
  the world, many predating the Gregorian system.</para>
d1101 4
a1104 3
  <para> 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.</para>
d1106 3
a1108 3
  <para> The People's Republic of China uses the Gregorian calendar
  for civil purposes. The Chinese calendar is used for determining
  festivals.
a1109 7

  <para> If you are interested in this sort of thing, <citation>
  Calendrical Calculations: The Millennium Edition </citation> by by
  Edward M. Reingold and Nachum Dershowitz is an excellent reference,
  describing some 25 calendars, and providing software for displaying
  them and converting between them.</para>

@


2.39
log
@Minor wordsmithing in datetime docs to try to address gripes raised by
cnliou.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/datetime.sgml,v 2.38 2003/11/29 19:51:36 pgsql Exp $
d14 2
a15 2
   value, ignored, or rejected.
   The parser contains internal lookup tables for all textual fields,
d1059 12
a1070 12
  <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.
d1072 2
a1073 2
   This is why Unix systems have the <command>cal</command> program
   produce the following:
d1097 2
a1098 3
  <para>
   Different calendars have been developed in various parts of the
   world, many predating the Gregorian system.
d1100 3
a1102 4
   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.
d1104 3
a1106 3
   The People's Republic of China uses the Gregorian calendar
   for civil purposes. The Chinese calendar is used for determining
   festivals.
d1108 7
@


2.38
log
@
$Header: -> $PostgreSQL Changes ...
@
text
@d2 1
a2 1
$PostgreSQL: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.37 2003/11/06 22:21:47 tgl Exp $
d373 4
a376 3
    abbreviations recognized by <productname>PostgreSQL</productname>.
    <productname>PostgreSQL</productname> contains internal tabular
    information for time zone decoding, since there is no standard
d381 9
@


2.37
log
@Minor copy-editing.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.36 2003/09/20 20:12:04 tgl Exp $
@


2.36
log
@Fix a batch of speling misteaks identified by Peter's spell-checker tool.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.35 2003/09/11 16:22:42 momjian Exp $
d998 1
a998 1
   and probably takes its name from the Scaliger's father,
d1010 1
a1010 1
   until the 1582, when countries started changing to the Gregorian
d1045 2
a1046 1
   By contrast, in the older Julian calendar only years divisible by 4 are leap years.
@


2.36.2.1
log
@Minor copy-editing.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.36 2003/09/20 20:12:04 tgl Exp $
d998 1
a998 1
   and probably takes its name from Scaliger's father,
d1010 1
a1010 1
   until the year 1582, when countries started changing to the Gregorian
d1045 1
a1045 2
   By contrast, in the older Julian calendar all years divisible by 4 are leap
   years.
@


2.36.2.2
log
@Minor wordsmithing in datetime docs to try to address gripes raised by
cnliou.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.36.2.1 2003/11/06 22:21:55 tgl Exp $
d373 3
a375 4
    abbreviations recognized by <productname>PostgreSQL</productname>
    in date/time input values.
    <productname>PostgreSQL</productname> uses internal tables
    for time zone input decoding, since there is no standard
a379 9
   </para>

   <para>
    Keep in mind also that the time zone names
    recognized by <command>SET TIMEZONE</> are operating-system
    dependent and may have little to do with <xref
    linkend="datetime-timezone-table">.  For example, some systems
    recognize values like <literal>'Europe/Rome'</> in <command>SET
    TIMEZONE</>.
@


2.35
log
@seemed like a typo in one of the appendix tables

Robert Treat
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.34 2003/08/31 17:32:18 petere Exp $
d573 1
a573 1
	<entry>Afganistan Time</entry>
@


2.34
log
@Add/edit index entries.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.33 2003/08/25 23:30:25 tgl Exp $
d347 1
a347 1
	<entry>Time is on or after after 12:00</entry>
@


2.33
log
@Add the Brazilian time zone abbreviations BRT, BRST, FNT, FNST.
ACT and ACST were already present.  AMT and AMST conflict with the
existing entries for Armenia; no change there for the moment.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.32 2003/07/29 00:03:17 tgl Exp $
d367 2
a368 1
    <primary>time zones</primary>
@


2.32
log
@Apply (a somewhat revised version of) Greg Mullane's patch to eliminate
heuristic determination of day vs month in date/time input.  Add the
ability to specify that input is interpreted as yy-mm-dd order (which
formerly worked, but only for yy greater than 31).  DateStyle's input
component now has the preferred spellings DMY, MDY, or YMD; the older
keywords European and US are now aliases for the first two of these.
Per recent discussions on pgsql-general.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.31 2003/04/07 01:29:25 petere Exp $
a538 8
<!--
       Conflicts with China Coastal Time
       <row>
	<entry>CCT</entry>
	<entry>+06:30</entry>
	<entry>Cocos Island Time</entry>
       </row>
-->
d542 1
a542 1
	<entry>Myannar Time</entry>
d755 15
d785 5
a809 5
	<entry>ACT</entry>
	<entry>-05:00</entry>
	<entry>Atlantic/Porto Acre Standard Time</entry>
       </row>
       <row>
d821 5
@


2.32.2.1
log
@Update this branch to match CVS head, includes WIN32 improvements.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.34 2003/08/31 17:32:18 petere Exp $
d367 1
a367 2
    <primary>time zone</primary>
    <secondary>abbreviations</secondary>
d539 8
d550 1
a550 1
	<entry>Myanmar Time</entry>
a762 15
	<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>
a777 5
	<entry>BRT</entry>
	<entry>-03:00</entry>
	<entry>Brasilia Time</entry>
       </row>
       <row>
d798 5
a813 5
       <row>
	<entry>ACT</entry>
	<entry>-05:00</entry>
	<entry>Atlantic/Porto Acre Standard Time</entry>
       </row>
@


2.31
log
@General editing
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.30 2003/03/13 01:30:27 petere Exp $
d30 1
a30 1
    The date/time type inputs are all decoded using the following routine.
d106 1
a106 1
	If not found, throw an error.
d114 1
a114 1
      The token is a number or number field.
d120 1
a120 1
	If there are more than 4 digits, 
d122 3
a124 3
	as a <quote>concatenated date</quote> (e.g., <literal>19990118</literal>). 8
	and 6 digits are interpreted as year, month, and day, while 7
	and 5 digits are interpreted as year, day of year, respectively.
d131 1
a131 1
	and a year has already been decoded, then interpret as day of year.
d138 1
a138 1
	interpret as a time.
d144 3
a146 1
	If four or more digits, then interpret as a year.
d152 3
a154 28
	If in European date mode, and if the day field has not yet been read,
	and if the value is less than or equal to 31, then interpret as a day.
       </para>
      </step>

      <step>
       <para>
	If the month field has not yet been read,
	and if the value is less than or equal to 12, then interpret as a month.
       </para>
      </step>

      <step>
       <para>
	If the day field has not yet been read,
	and if the value is less than or equal to 31, then interpret as a day.
       </para>
      </step>

      <step>
       <para>
	If two digits or four or more digits, then interpret as a year.
       </para>
      </step>

      <step>
       <para>
	Otherwise, throw an error.
@


2.30
log
@Big editing for consistent content and presentation.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.29 2002/11/11 20:14:02 petere Exp $
d213 1
a213 1
  <sect1>
@


2.29
log
@Merge documentation updates from 7.3 branch.
@
text
@d2 1
a2 2
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.28 2002/08/04 06:15:45 thomas Exp $
Date/time details
d6 1
a6 1
  <title id="datetime-appendix-title">Date/Time Support</title>
d30 1
a30 1
    The date/time types are all decoded using a common set of routines.
a33 2
    <title>Date/Time Input Interpretation</title>

d61 1
a61 1
	(e.g. <literal>141516</literal> for 14:15:16).
d187 1
a187 1
      calendar, so numerically <literal>1BC</literal> becomes year
d195 2
a196 2
      adjust the year to 4 digits. If the field was less than 70, then add 2000;
      otherwise, add 1900.
d382 2
a383 2
    reasons; in very old releases of
    <productname>PostgreSQL</productname> invalid fields of type <type>abstime</type>
d406 1
a406 1
    rather than alphabetically; this is intended to facilitate
d425 1
a425 1
	<entry>New Zealand Daylight Time</entry>
d455 1
a455 1
	<entry>Central Australia Daylight Savings Time</entry>
d460 1
a460 1
	<entry>South Australian Daylight Time</entry>
d475 1
a475 1
	<entry>Guam Standard Time, USSR Zone 9</entry>
d500 1
a500 1
	<entry>Japan Standard Time,USSR Zone 8</entry>
d515 1
a515 1
	<entry>West Australian Daylight Time</entry>
d535 1
a535 1
	<entry>West Australian Daylight Time</entry>
d608 1
a608 1
	<entry>Antananarivo Savings Time</entry>
d643 1
a643 1
	<entry>Eastern Europe Daylight Savings Time</entry>
d658 1
a658 1
	<entry>Central European Savings Time</entry>
d663 1
a663 1
	<entry>Central European Daylight Savings Time</entry>
d668 1
a668 1
	<entry>Eastern Europe, USSR Zone 1</entry>
d683 1
a683 1
	<entry>Middle Europe Summer Time</entry>
d688 1
a688 1
	<entry>Middle Europe Daylight Time</entry>
d718 1
a718 1
	<entry>Middle Europe Time</entry>
d723 1
a723 1
	<entry>Middle Europe Winter Time</entry>
d728 1
a728 1
	<entry>Middle Europe Zone</entry>
d748 1
a748 1
	<entry>Western Europe Daylight Savings Time</entry>
d752 1
a752 1
	<entry>+00:00</entry>
d757 1
a757 1
	<entry>+00:00</entry>
d762 2
a763 2
	<entry>+00:00</entry>
	<entry>Universal Time, Coordinated</entry>
d767 1
a767 1
	<entry>+00:00</entry>
d772 1
a772 1
	<entry>+00:00</entry>
d777 2
a778 2
	<entry>+00:00</entry>
	<entry>Western Europe</entry>
d788 1
a788 1
	<entry>Newfoundland Daylight Time</entry>
d793 1
a793 1
	<entry>Atlantic Daylight Time</entry>
d828 1
a828 1
	<entry>Eastern Daylight Time</entry>
d840 1
a840 1
	<entry>Central Daylight Time</entry>
d862 1
a862 1
	<entry>Mountain Daylight Time</entry>
d879 1
a879 1
	<entry>Pacific Daylight Time</entry>
d884 1
a884 1
	<entry>Alaska Daylight Time</entry>
d894 1
a894 1
	<entry>Yukon Daylight Time</entry>
d904 1
a904 1
	<entry>Hawaii/Alaska Daylight Time</entry>
d919 1
a919 1
	<entry>Alaska-Hawaii Standard Time</entry>
d950 1
a950 1
    names with time zones commonly used in North and South America:
d953 1
a953 1
    <varname>AUSTRALIAN_TIMEZONES</varname> is set to true then
d1002 1
a1002 1
  <sect1 id="units-history">
a1004 6
  <note>
   <para>
    Contributed by José Soares (<email>jose@@sferacarta.com</email>)
   </para>
  </note>

d1006 1
a1006 1
   The Julian Day was invented by the French scholar
d1011 1
a1011 1
   every day since 1 January 4713 BC. This is the so-called Julian Day
d1017 2
a1018 2
   The <quote>Julian Day</quote> is different from the <quote>Julian
   Date</quote>.  The Julian date refers to the Julian calendar, which
@


2.28
log
@Add Myannar Time, Iran Time variant name, and Marquesas Time.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.27 2002/03/22 19:20:07 petere Exp $
d11 1
a11 1
   parser for all date/time support. Dates and times are input as
d28 1
a28 1
   <title>Date/Time Keywords</title>
d31 194
a224 1
    <table tocentry="1">
d284 1
a284 1
      The month <literal>May</literal> has no explicit abbreviation, for obvious reasons.
a286 1
   </para>
d289 6
a294 1
     <table tocentry="1">
a334 1
    </para>
d337 6
a342 3
    <table tocentry="1">
     <title><productname>PostgreSQL</productname> Field Modifiers</title>
     <titleabbrev>Field Modifiers</titleabbrev>
d353 1
a353 1
	<entry>Keyword ignored</entry>
d361 1
a361 1
	<entry>Keyword ignored</entry>
d369 1
a369 1
	<entry>Keyword ignored</entry>
a381 1
   </para>
d384 1
a384 1
    The keyword <literal>ABSTIME</literal> is ignored for historical
d386 3
a388 3
    <productname>PostgreSQL</productname> invalid <type>ABSTIME</type>
    fields were emitted as <literal>Invalid Abstime</literal>. This is no
    longer the case however and this keyword will likely be dropped in
a390 4
  </sect1>

  <sect1 id="timezones">
   <title>Time Zones</title>
d392 1
a392 1
   <indexterm zone="timezones">
d397 2
d400 5
a404 4
    information for time zone decoding, since there is no *nix standard
    system interface to provide access to general, cross-timezone
    information. The underlying OS <emphasis>is</emphasis> used to
    provide time zone information for <emphasis>output</emphasis>, however.
d408 2
a409 4
    The following table of time zones recognized by
    <productname>PostgreSQL</productname> is organized by time
    zone offset from UTC, rather than alphabetically; this is intended
    to facilitate
d412 1
d414 2
a415 3
    <table tocentry="1">
     <title><productname>PostgreSQL</productname> Recognized Time Zones</title>
     <titleabbrev>Time Zones</titleabbrev>
a946 1
   </para>
d948 1
a948 1
  <sect2>
d952 13
a964 5
    Australian time zones and their naming variants
    account for fully one quarter of all time zones in the 
    <productname>PostgreSQL</productname> time zone lookup table.
    There are two naming conflicts with time zones commonly used
    in the United States, <literal>CST</literal> and <literal>EST</literal>.
d966 1
d968 2
a969 12
   <para>
    If the run-time option <literal>AUSTRALIAN_TIMEZONES</literal> is set 
    then <literal>CST</literal>, <literal>EST</literal>, and
    <literal>SAT</literal> will be
    interpreted as Australian timezone names.  Without this option,
    <literal>CST</literal> and <literal>EST</literal> are taken as
    American timezone names, while <literal>SAT</literal> is interpreted as a
    noise word indicating <literal>Saturday</literal>.

    <table tocentry="1">
     <title><productname>PostgreSQL</productname> Australian Time Zones</title>
     <titleabbrev>Australian Time Zones</titleabbrev>
a1001 2
   </para>
  </sect2>
d1003 1
a1003 100
  <sect2>
   <title>Date/Time Input Interpretation</title>

   <para>
    The date/time types are all decoded using a common set of routines.
   </para>

   <procedure>
    <title>Date/Time Input Interpretation</title>

    <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 (":"), this is a time
	 string. Include all subsequent digits and colons.
       </para>
      </step>

      <step>
       <para>
	If the numeric token contains a dash ("-"), slash ("/"), or
	 two or more dots ("."),
	this is a date string which may have a text month.
       </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. 141516 for 14:15:16).
       </para>
      </step>
      <step>
       <para>
	If the token starts with a plus ("+") or minus ("-"),
	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 not found, throw an error.
       </para>
      </step>
     </substeps>
    </step>
    
    <step>
     <para>
      The token is a number or number field.
     </para>

     <substeps>
      <step>
       <para>
	If there are more than 4 digits, 
	and if no other date fields have been previously read, then interpret 
	as a <quote>concatenated date</quote> (e.g. <literal>19990118</literal>). 8
	and 6 digits are interpreted as year, month, and day, while 7
	and 5 digits are interpreted as year, day of year, respectively.
       </para>
      </step>
d1005 1
a1005 86
      <step>
       <para>
	If the token is three digits
	and a year has already been decoded, 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. 
       </para>
      </step>

      <step>
       <para>
	If four or more digits, then interpret as a year.
       </para>
      </step>

      <step>
       <para>
	If in European date mode, and if the day field has not yet been read,
	and if the value is less than or equal to 31, then interpret as a day.
       </para>
      </step>

      <step>
       <para>
	If the month field has not yet been read,
	and if the value is less than or equal to 12, then interpret as a month.
       </para>
      </step>

      <step>
       <para>
	If the day field has not yet been read,
	and if the value is less than or equal to 31, then interpret as a day.
       </para>
      </step>

      <step>
       <para>
	If two digits or four or more digits, then interpret as a year.
       </para>
      </step>

      <step>
       <para>
	Otherwise, throw an error.
       </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
      <literal>1BC</literal> 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 4 digits. If the field was less than 70, then add 2000;
      otherwise, add 1900.

      <tip>
       <para>
	Gregorian years 1-99AD may be entered by using 4 digits with leading
	zeros (e.g. 0099 is 99AD). 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.
       </para>
      </tip>
     </para>
    </step>
   </procedure>
  </sect2>
 </sect1>

 <sect1 id="units-history">
d1025 8
a1032 13
  <para>
   <quote>Julian Day</quote> is different from <quote>Julian Date</quote>.

   The Julian calendar was introduced by Julius Caesar in 45 BC. It was
   in common use until the 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.
   The accumulating calendar error prompted  Pope Gregory XIII 
   to reform the calendar in accordance with instructions
   from the Council of Trent.
d1036 3
d1074 1
a1074 1
   until the start of this century.
d1078 1
a1078 1
   Thus 2 Sep 1752 was followed by 14 Sep 1752.
d1080 1
a1080 1
   This is why Unix systems have <application>cal</application>
d1083 2
a1084 2
   <programlisting>
% cal 9 1752
d1090 1
a1090 1
   </programlisting>
d1093 11
a1103 12
  <note>
   <para>
    SQL92 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>
d1115 1
a1115 1
   for civil purposes. Chinese calendar is used for determining
@


2.28.2.1
log
@Cleanup pass over User's Guide.  Key word table updated.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/datetime.sgml,v 2.28 2002/08/04 06:15:45 thomas Exp $
d11 1
a11 1
   parser for all date/time input support. Dates and times are input as
d28 1
a28 1
   <title>Date/Time Input Interpretation</title>
d31 1
a31 194
    The date/time types are all decoded using a common set of routines.
   </para>

   <procedure>
    <title>Date/Time Input Interpretation</title>

    <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.
       </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 not found, throw an error.
       </para>
      </step>
     </substeps>
    </step>
    
    <step>
     <para>
      The token is a number or number field.
     </para>

     <substeps>
      <step>
       <para>
	If there are more than 4 digits, 
	and if no other date fields have been previously read, then interpret 
	as a <quote>concatenated date</quote> (e.g., <literal>19990118</literal>). 8
	and 6 digits are interpreted as year, month, and day, while 7
	and 5 digits are interpreted as year, day of year, respectively.
       </para>
      </step>

      <step>
       <para>
	If the token is three digits
	and a year has already been decoded, 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.
       </para>
      </step>

      <step>
       <para>
	If four or more digits, then interpret as a year.
       </para>
      </step>

      <step>
       <para>
	If in European date mode, and if the day field has not yet been read,
	and if the value is less than or equal to 31, then interpret as a day.
       </para>
      </step>

      <step>
       <para>
	If the month field has not yet been read,
	and if the value is less than or equal to 12, then interpret as a month.
       </para>
      </step>

      <step>
       <para>
	If the day field has not yet been read,
	and if the value is less than or equal to 31, then interpret as a day.
       </para>
      </step>

      <step>
       <para>
	If two digits or four or more digits, then interpret as a year.
       </para>
      </step>

      <step>
       <para>
	Otherwise, throw an error.
       </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 <literal>1BC</literal> 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 4 digits. If the field was 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). 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.
       </para>
      </tip>
     </para>
    </step>
   </procedure>
  </sect1>


  <sect1>
   <title>Date/Time Key Words</title>

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

    <table id="datetime-month-table">
d91 1
a91 1
      The month May has no explicit abbreviation, for obvious reasons.
d94 1
d97 1
a97 6
     <xref linkend="datetime-dow-table"> shows the tokens that are
     permissible as abbreviations for the names of the days of the
     week.
    </para>

     <table id="datetime-dow-table">
d138 1
d141 3
a143 6
    <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>
d154 1
a154 1
	<entry>Key word ignored</entry>
d162 1
a162 1
	<entry>Key word ignored</entry>
d170 1
a170 1
	<entry>Key word ignored</entry>
d183 1
d186 1
a186 1
    The key word <literal>ABSTIME</literal> is ignored for historical
d188 3
a190 3
    <productname>PostgreSQL</productname> invalid fields 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
d193 4
d198 1
a198 1
   <indexterm>
a202 2
    <xref linkend="datetime-timezone-table"> shows the time zone
    abbreviations recognized by <productname>PostgreSQL</productname>.
d204 4
a207 5
    information for time zone decoding, since there is no standard
    operating system interface to provide access to general,
    cross-time zone information. The underlying operating system
    <emphasis>is</emphasis> used to provide time zone information for
    <emphasis>output</emphasis>, however.
d211 4
a214 2
    The table is organized by time zone offset from <acronym>UTC</>,
    rather than alphabetically; this is intended to facilitate
a216 1
   </para>
d218 3
a220 2
    <table id="datetime-timezone-table">
     <title>Time Zone Abbreviations</title>
d752 1
d754 1
a754 1
  <formalpara>
d758 5
a762 13
    There are three naming conflicts between Australian time zone
    names with time zones commonly used in North and South America:
    <literal>ACST</literal>, <literal>CST</literal>, and
    <literal>EST</literal>.  If the run-time option
    <varname>AUSTRALIAN_TIMEZONES</varname> is set to true then
    <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.
a763 1
  </formalpara>
d765 12
a776 2
    <table id="datetime-oztz-table">
     <title>Australian Time Zone Abbreviations</title>
d809 103
d913 84
a996 1
  </sect1>
d998 1
a998 1
  <sect1 id="units-history">
d1018 13
a1030 8
   <para>
   The <quote>Julian Day</quote> is different from the <quote>Julian
   Date</quote>.  The Julian date refers to the Julian calendar, which
   was introduced by Julius Caesar in 45 BC. It was in common use
   until the 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.
a1033 3
   The accumulating calendar error prompted
   Pope Gregory XIII to reform the calendar in accordance with
   instructions from the Council of Trent.
d1069 1
a1069 1
   until the start of the 20th century.
d1073 1
a1073 1
   Thus 2 September 1752 was followed by 14 September 1752.
d1075 1
a1075 1
   This is why Unix systems have the <command>cal</command> program
d1078 2
a1079 2
<screen>
$ <userinput>cal 9 1752</userinput>
d1085 1
a1085 1
</screen>
d1088 12
a1099 11
   <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>
d1111 1
a1111 1
   for civil purposes. The Chinese calendar is used for determining
@


2.27
log
@Spell checking and markup additions
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.26 2002/01/20 22:19:55 petere Exp $
a369 5
       <row>
	<entry>ALMT</entry>
	<entry>+06:00</entry>
	<entry>Almaty Time</entry>
       </row>
d379 10
d434 1
a434 1
	<entry>IT</entry>
d718 5
@


2.26
log
@Spell-check and markup police
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.25 2002/01/04 17:02:25 thomas Exp $
d153 1
a153 1
	<entry>ABSTIME</entry>
d157 1
a157 1
	<entry>AM</entry>
d161 1
a161 1
	<entry>AT</entry>
d165 1
a165 1
	<entry>JULIAN, JD, J</entry>
d169 1
a169 1
	<entry>ON</entry>
d173 1
a173 1
	<entry>PM</entry>
d177 1
a177 1
	<entry>T</entry>
d189 1
a189 1
    fields were emitted as <quote>Invalid Abstime</quote>. This is no
d756 1
a756 1
    If the runtime option <literal>AUSTRALIAN_TIMEZONES</literal> is set 
@


2.25
log
@Add more complete details on date/time keywords and parsing rules.
Move some tabular information on these from the chapter on data types to
 the appendix on dates and times.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.24 2001/12/29 18:35:47 thomas Exp $
d214 2
a215 2
    to faciliate
    matching local usage with recognized abreviations for cases where
d1081 2
a1082 2
    <quote>Within the definition of a <sgmltag>datetime literal</sgmltag>,
     the <sgmltag>datetime value</sgmltag>s are constrained by the
@


2.24
log
@Document the precision arguments for date/time types per SQL9x.
Update the list of recognized time zones.
Document the range of arguments allowed for SET TIME ZONE.
Still need to add info on other date/time symbols (e.g. "AM", "T")
 and to freshen the docs on the date/time parsing rules.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.23 2001/11/21 05:53:41 thomas Exp $
d9 186
d208 9
d559 20
d821 2
a822 1
	If the token contains a colon (":"), this is a time string.
d828 2
a829 1
	If the token contains a dash ("-"), slash ("/"), or dot ("."),
d837 2
a838 1
	or an ISO-8601 concatenated date (e.g. <literal>19990113</literal> for January 13, 1999)
d912 7
d960 1
a960 1
      If BC has been specified, negate the year and offset by one for
d963 1
a963 1
      1BC becomes year zero).
@


2.23
log
@Deprecate 'current' for date/time input.
Fix up references to "PostgreSQL" rather than "Postgres". Was roughly
 evenly split between the two before. ref/ files not yet done.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.22 2001/09/28 08:15:35 thomas Exp $
d57 1
a57 1
	<entry>+11:00 </entry>
d62 1
a62 1
	<entry>+10:30 </entry>
d67 1
a67 1
	<entry>+10:30 </entry>
d77 1
a77 1
	<entry>+10:00 </entry>
d82 1
a82 1
	<entry>+10:00 </entry>
a95 5
	<entry>ACST</entry>
	<entry>+09:30 </entry>
	<entry>Central Australia Standard Time</entry>
       </row>
       <row>
d97 1
a97 1
	<entry>+09:30 </entry>
d102 1
a102 1
	<entry>+09:30 </entry>
d107 1
a107 1
	<entry>+9:00 </entry>
d112 1
a112 1
	<entry>+9:00</entry>
d117 1
a117 1
	<entry>+9:00</entry>
d121 5
d127 1
a127 1
	<entry>+9:00</entry>
d132 1
a132 1
	<entry>+8:30</entry>
d137 1
a137 1
	<entry>+8:00 </entry>
d142 1
a142 1
	<entry>+8:00 </entry>
d147 1
a147 1
	<entry>+8:00</entry>
d152 1
a152 1
	<entry>+8:00</entry>
d157 1
a157 1
	<entry>+7:30</entry>
d161 5
d167 1
a167 1
	<entry>+7:00</entry>
d172 1
a172 1
	<entry>+7:00</entry>
d175 5
d184 1
a184 1
	<entry>+6:30 </entry>
d189 5
d195 1
a195 1
	<entry>+5:00</entry>
d200 1
a200 1
	<entry>+5:00</entry>
d205 1
a205 1
	<entry>+5:00</entry>
d209 5
d215 1
a215 1
	<entry>+4:00</entry>
d220 1
a220 1
	<entry>+4:00</entry>
d225 1
a225 1
	<entry>+4:00</entry>
d230 1
a230 1
	<entry>+4:00</entry>
d235 1
a235 1
	<entry>+3:30</entry>
d240 1
a240 1
	<entry>+3:00</entry>
d245 1
a245 1
	<entry>+3:00 </entry>
d250 1
a250 1
	<entry>+3:00 </entry>
d254 5
d260 1
a260 1
	<entry>+2:00 </entry>
d265 1
a265 1
	<entry>+2:00 </entry>
d270 1
a270 1
	<entry>+2:00 </entry>
d275 1
a275 1
	<entry>+2:00 </entry>
d280 1
a280 1
	<entry>+2:00</entry>
d285 1
a285 1
	<entry>+2:00</entry>
d290 1
a290 1
	<entry>+2:00</entry>
d295 1
a295 1
	<entry>+2:00</entry>
d300 1
a300 1
	<entry>+2:00</entry>
d305 1
a305 1
	<entry>+1:00 </entry>
d310 1
a310 1
	<entry>+1:00 </entry>
d315 1
a315 1
	<entry>+1:00 </entry>
d320 1
a320 1
	<entry>+1:00 </entry>
d325 1
a325 1
	<entry>+1:00</entry>
d330 1
a330 1
	<entry>+1:00</entry>
d335 1
a335 1
	<entry>+1:00</entry>
d340 1
a340 1
	<entry>+1:00</entry>
d345 1
a345 1
	<entry>+1:00</entry>
d350 1
a350 1
	<entry>+1:00</entry>
d355 1
a355 1
	<entry>+1:00</entry>
d360 1
a360 1
	<entry>0:00</entry>
d365 1
a365 1
	<entry>0:00</entry>
d370 1
a370 1
	<entry>-1:00</entry>
d375 1
a375 1
	<entry>-2:30</entry>
d380 1
a380 1
	<entry>-03:00 </entry>
d384 5
d390 1
a390 1
	<entry>-3:30</entry>
d395 1
a395 1
	<entry>-3:30</entry>
d400 1
a400 1
	<entry>-4:00 </entry>
d404 10
d415 1
a415 1
	<entry>-4:00 </entry>
d421 1
a421 1
      <entry>-4:00</entry>
d427 1
a427 1
	<entry>-5:00 </entry>
d432 1
a432 1
	<entry>-5:00 </entry>
d438 1
a438 1
      <entry>-5:00</entry>
d444 1
a444 1
	<entry>-6:00 </entry>
d449 1
a449 1
	<entry>-6:00</entry>
d455 1
a455 1
      <entry>-6:00</entry>
d461 1
a461 1
	<entry>-7:00</entry>
d466 1
a466 1
	<entry>-7:00</entry>
d470 5
d476 1
a476 1
	<entry>-8:00</entry>
d481 1
a481 1
	<entry>-8:00</entry>
d485 5
d491 1
a491 1
	<entry>-9:00</entry>
d496 1
a496 1
	<entry>-9:00</entry>
d501 1
a501 1
	<entry>-10:00 </entry>
d505 5
d511 1
a511 1
	<entry>-10:00 </entry>
d562 5
d578 1
a578 1
	<entry>+9:30</entry>
d645 1
a645 1
	or noise word (e.g. <literal>on</literal>).
@


2.22
log
@Add information on new timestamp and timestamptz data types.
Start chapter on recovery techniques. Still needs work for release.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.21 2001/09/13 15:55:22 petere Exp $
d6 2
a7 2
<appendix id="datetime-appendix">
 <title id="datetime-appendix-title">Date/Time Support</title>
d9 2
a10 2
 <sect1 id="timezones">
  <title>Time Zones</title>
d12 158
a169 303
  <indexterm zone="timezones">
   <primary>time zones</primary>
  </indexterm>

  <para>
   <productname>Postgres</productname> contains internal tabular
   information for time zone decoding, since there is no *nix standard
   system interface to provide access to general, cross-timezone
   information. The underlying OS <emphasis>is</emphasis> used to
   provide time zone information for <emphasis>output</emphasis>, however.

   <table tocentry="1">
    <title><productname>Postgres</productname> Recognized Time Zones</title>
    <titleabbrev>Time Zones</titleabbrev>
    <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 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 Savings Time</entry>
      </row>
      <row>
       <entry>SADT</entry>
       <entry>+10:30</entry>
       <entry>South Australian Daylight 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, USSR Zone 9</entry>
      </row>
      <row>
       <entry>LIGT</entry>
       <entry>+10:00</entry>
       <entry>Melbourne, Australia</entry>
      </row>
      <row>
       <entry>ACST</entry>
       <entry>+09:30 </entry>
       <entry>Central Australia Standard Time</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>+9:00 </entry>
       <entry>Australia Western Summer Standard Time</entry>
      </row>
      <row>
       <entry>JST</entry>
       <entry>+9:00</entry>
       <entry>Japan Standard Time,USSR Zone 8</entry>
      </row>
      <row>
       <entry>KST</entry>
       <entry>+9:00</entry>
       <entry>Korea Standard Time</entry>
      </row>
      <row>
       <entry>WDT</entry>
       <entry>+9:00</entry>
       <entry>West Australian Daylight Time</entry>
      </row>
      <row>
       <entry>MT</entry>
       <entry>+8:30</entry>
       <entry>Moluccas Time</entry>
      </row>
      <row>
       <entry>AWST</entry>
       <entry>+8:00 </entry>
       <entry>Australia Western Standard Time</entry>
      </row>
      <row>
       <entry>CCT</entry>
       <entry>+8:00 </entry>
       <entry>China Coastal Time</entry>
      </row>
      <row>
       <entry>WADT</entry>
	 <entry>+8:00</entry>
       <entry>West Australian Daylight Time</entry>
      </row>
      <row>
       <entry>WST</entry>
       <entry>+8:00</entry>
       <entry>West Australian Standard Time</entry>
      </row>
      <row>
       <entry>JT</entry>
       <entry>+7:30</entry>
       <entry>Java Time</entry>
      </row>
      <row>
       <entry>WAST</entry>
       <entry>+7:00</entry>
       <entry>West Australian Standard Time</entry>
	</row>
      <row>
       <entry>IT</entry>
	 <entry>+3:30</entry>
       <entry>Iran Time</entry>
      </row>
      <row>
       <entry>BT</entry>
       <entry>+3:00 </entry>
       <entry>Baghdad Time</entry>
      </row>
      <row>
       <entry>EETDST</entry>
       <entry>+3:00 </entry>
       <entry>Eastern Europe Daylight Savings Time</entry>
      </row>
      <row>
       <entry>CETDST</entry>
       <entry>+2:00 </entry>
       <entry>Central European Daylight Savings Time</entry>
      </row>
      <row>
       <entry>EET</entry>
       <entry>+2:00 </entry>
       <entry>Eastern Europe, USSR Zone 1</entry>
      </row>
      <row>
       <entry>FWT</entry>
       <entry>+2:00</entry>
       <entry>French Winter Time</entry>
      </row>
      <row>
       <entry>IST</entry>
       <entry>+2:00</entry>
       <entry>Israel Standard Time</entry>
      </row>
      <row>
       <entry>MEST</entry>
       <entry>+2:00</entry>
       <entry>Middle Europe Summer Time</entry>
      </row>
	<row>
       <entry>METDST</entry>
       <entry>+2:00</entry>
       <entry>Middle Europe Daylight Time</entry>
      </row>
      <row>
       <entry>SST</entry>
       <entry>+2:00</entry>
       <entry>Swedish Summer Time</entry>
      </row>
      <row>
       <entry>BST</entry>
       <entry>+1:00 </entry>
       <entry>British Summer Time</entry>
      </row>
      <row>
       <entry>CET</entry>
       <entry>+1:00 </entry>
       <entry>Central European Time</entry>
      </row>
      <row>
       <entry>DNT</entry>
       <entry>+1:00 </entry>
       <entry><foreignphrase>Dansk Normal Tid</foreignphrase></entry>
      </row>
      <row>
       <entry>FST</entry>
       <entry>+1:00 </entry>
       <entry>French Summer Time</entry>
	</row>
      <row>
       <entry>MET</entry>
       <entry>+1:00</entry>
       <entry>Middle Europe Time</entry>
      </row>
      <row>
       <entry>MEWT</entry>
       <entry>+1:00</entry>
       <entry>Middle Europe Winter Time</entry>
	</row>
      <row>
       <entry>MEZ</entry>
       <entry>+1:00</entry>
       <entry>Middle Europe Zone</entry>
      </row>
      <row>
       <entry>NOR</entry>
       <entry>+1:00</entry>
       <entry>Norway Standard Time</entry>
      </row>
      <row>
       <entry>SET</entry>
       <entry>+1:00</entry>
       <entry>Seychelles Time</entry>
      </row>
      <row>
       <entry>SWT</entry>
       <entry>+1:00</entry>
       <entry>Swedish Winter Time</entry>
      </row>
      <row>
       <entry>WETDST</entry>
       <entry>+1:00</entry>
       <entry>Western Europe Daylight Savings Time</entry>
      </row>
      <row>
       <entry>GMT</entry>
       <entry>0:00</entry>
       <entry>Greenwich Mean Time</entry>
      </row>
      <row>
       <entry>WET</entry>
       <entry>0:00</entry>
       <entry>Western Europe</entry>
      </row>
      <row>
       <entry>WAT</entry>
       <entry>-1:00</entry>
       <entry>West Africa Time</entry>
      </row>
      <row>
       <entry>NDT</entry>
       <entry>-2:30</entry>
       <entry>Newfoundland Daylight Time</entry>
      </row>
      <row>
       <entry>ADT</entry>
       <entry>-03:00 </entry>
       <entry>Atlantic Daylight Time</entry>
      </row>
      <row>
       <entry>NFT</entry>
       <entry>-3:30</entry>
       <entry>Newfoundland Standard Time</entry>
      </row>
      <row>
       <entry>NST</entry>
       <entry>-3:30</entry>
       <entry>Newfoundland Standard Time</entry>
      </row>
      <row>
       <entry>AST</entry>
       <entry>-4:00 </entry>
       <entry>Atlantic Standard Time (Canada)</entry>
      </row>
      <row>
       <entry>EDT</entry>
       <entry>-4:00 </entry>
       <entry>Eastern Daylight Time</entry>
      </row>
d171 6
a176 5
      <row>
       <entry>ZP4</entry>
       <entry>-4:00</entry>
       <entry>GMT +4 hours</entry>
      </row>
d178 201
d380 3
a382 3
       <entry>CDT</entry>
       <entry>-5:00 </entry>
       <entry>Central Daylight Time</entry>
d384 12
d397 3
a399 3
       <entry>EST</entry>
       <entry>-5:00 </entry>
       <entry>Eastern Standard Time</entry>
d401 12
a412 1
<!--
d414 3
a416 3
       <entry>ZP5</entry>
       <entry>-5:00</entry>
       <entry>GMT +5  hours</entry>
d418 55
a472 72
-->
      <row>
       <entry>CST</entry>
       <entry>-6:00 </entry>
       <entry>Central Standard Time</entry>
      </row>
      <row>
       <entry>MDT</entry>
       <entry>-6:00</entry>
       <entry>Mountain Daylight Time</entry>
      </row>
<!--
      <row>
       <entry>ZP6</entry>
       <entry>-6:00</entry>
       <entry>GMT +6  hours</entry>
      </row>
-->
      <row>
       <entry>MST</entry>
       <entry>-7:00</entry>
       <entry>Mountain Standard Time</entry>
      </row>
      <row>
       <entry>PDT</entry>
       <entry>-7:00</entry>
       <entry>Pacific Daylight Time</entry>
      </row>
      <row>
       <entry>PST</entry>
       <entry>-8:00</entry>
       <entry>Pacific Standard Time</entry>
      </row>
      <row>
       <entry>YDT</entry>
       <entry>-8:00</entry>
       <entry>Yukon Daylight Time</entry>
      </row>
      <row>
       <entry>HDT</entry>
       <entry>-9:00</entry>
       <entry>Hawaii/Alaska Daylight Time</entry>
      </row>
      <row>
       <entry>YST</entry>
       <entry>-9:00</entry>
       <entry>Yukon Standard Time</entry>
      </row>
      <row>
       <entry>AHST</entry>
       <entry>-10:00 </entry>
       <entry>Alaska-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>
  </para>
d480 1
a480 1
    <productname>Postgres</productname> time zone lookup table.
d495 1
a495 1
     <title><productname>Postgres</productname> Australian Time Zones</title>
d692 1
a692 1
	<productname>Postgres</productname> accepted years with three
@


2.21
log
@Replace ASCII-quotes with proper markup.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.20 2001/09/09 17:21:58 petere Exp $
d17 1
a17 1
   <productname>Postgres</productname> must have internal tabular
@


2.20
log
@Markup additions and spell check. (covers User's Guide)
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.19 2001/06/18 19:05:11 tgl Exp $
d429 1
a429 1
    noise word indicating "<literal>Saturday</literal>".
d497 1
a497 1
	or an ISO-8601 concatenated date (e.g. "19990113" for January 13, 1999)
d556 1
a556 1
	as a "concatenated date" (e.g. <literal>19990118</literal>). 8
d661 1
a661 1
   "Julian Day" is different from "Julian Date".
@


2.19
log
@Fix some references to USE_AUSTRALIAN_RULES that Bruce missed;
plus a few trivial improvements in wording.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.18 2001/05/12 22:51:34 petere Exp $
d228 1
a228 1
       <entry>Dansk Normal Tid</entry>
@


2.18
log
@Add index.  Only some parts of the manual set have index entries so far...
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.17 2001/02/12 14:21:27 momjian Exp $
d21 1
a21 1
   provide time zone information for <emphasis>output</emphasis>.
d48 1
a48 1
       <entry>New Zealand Std Time</entry>
d58 1
a58 1
       <entry>Australia Eastern Summer Std Time</entry>
d63 1
a63 1
       <entry>Central Australia Summer Std Time</entry>
d78 1
a78 1
       <entry>Australia Eastern Std Time</entry>
d83 1
a83 1
       <entry>East Australian Std Time</entry>
d88 1
a88 1
       <entry>Guam Std Time, USSR Zone 9</entry>
d98 1
a98 1
       <entry>Central Australia Std Time</entry>
d103 1
a103 1
       <entry>South Australia Std Time</entry>
d108 1
a108 1
       <entry>Central Australia Std Time</entry>
d113 1
a113 1
       <entry>Australia Western Summer Std Time</entry>
d118 1
a118 1
       <entry>Japan Std Time,USSR Zone 8</entry>
d138 1
a138 1
       <entry>Australia Western Std Time</entry>
d153 1
a153 1
       <entry>West Australian Std Time</entry>
d163 1
a163 1
       <entry>West Australian Std Time</entry>
d198 1
a198 1
       <entry>Israel Std Time</entry>
d308 1
a308 1
       <entry>Atlantic Std Time (Canada)</entry>
d342 1
a342 1
       <entry>Central Std Time</entry>
d369 1
a369 1
       <entry>Pacific Std Time</entry>
d389 1
a389 1
       <entry>Alaska-Hawaii Std Time</entry>
d418 1
a418 1
    There are two naming conflicts with common time zones defined
d423 1
a423 1
    If the compiler option USE_AUSTRALIAN_RULES is set 
d426 4
a429 3
    interpreted using Australian conventions. Without this option,
    <literal>SAT</literal> is interpreted as a noise word indicating
    "<literal>Saturday</literal>".
d456 1
a456 1
	<entry>South Australian Std Time</entry>
@


2.17
log
@ User Manual
  Chapter 4
   String Operators
    Table 4.7: Other String Functions
      strpos is missing the result in the result column, it should be 2
      Also to_ascii might need a result but maybe not.

Appendix A
In the Time Zone Table
 Greenwich is spelled Greenwish

David Aldrich
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.16 2001/01/06 11:58:55 petere Exp $
d11 4
@


2.16
log
@Update section on SQL syntax.  (Still a lot to be done though.)  Add
appendix with comprehensive list of key words.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.15 2000/12/22 21:51:57 petere Exp $
d269 1
a269 1
       <entry>Greenwish Mean Time</entry>
@


2.15
log
@Make use of <email> tag for marking up email addresses.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.14 2000/12/21 22:55:27 petere Exp $
d6 1
a6 1
<appendix label="UG1" id="datetime-appendix">
@


2.14
log
@Get rid of the little "v"s in front of version numbers, substituting the
full word "version" where appropriate.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.13 2000/10/20 13:57:10 thomas Exp $
d640 1
a640 2
    Contributed by 
    <ulink url="mailto:jose@@sferacarta.com">José Soares</ulink>.
@


2.13
log
@Remove ZP4, ZP5, ZP6 from docs since the current parser won't accept
 time zones with embedded numerals (parsing to a meaninless "ZP 4"
 instead).
Support "SAT" as an Australian time zone if USE_AUSTRALIAN_RULES
 is defined.
Fix units in exposition on Julian calendar (from Lazer Henry I think...)
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.12 2000/09/29 20:21:33 petere Exp $
d625 1
a625 1
	digits and with single digits, but as of v7.0 the rules have
@


2.12
log
@Add `id' attributes to all `chapter' and `sect1' tags, to generate useful
names for the HTML files (e.g., not x4856.htm).
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.11 2000/08/23 05:59:01 thomas Exp $
d97 5
a106 5
       <entry>SAT</entry>
       <entry>+9:30</entry>
       <entry>South Australian Std Time</entry>
      </row>
      <row>
a226 5
       <entry>DST</entry>
       <entry>+1:00 </entry>
       <entry>Dansk Standard Time (?)</entry>
      </row>
      <row>
d311 1
d317 1
d328 1
d334 1
d345 1
d351 1
d420 5
a424 2
    then <literal>CST</literal> and <literal>EST</literal> will be
    interpreted using Australian conventions.
d448 5
d664 3
a666 3
   days = 365.25 days. This gives an error of 1 day in approximately
   128 days.
   The accumulating calendar error prompted  pope Gregory XIII 
@


2.11
log
@Fix several <ulink> tags which refer to e-mail addresses
 but were missing the "mailto:" prefix.
Fix typo.
Thanks to Neil Conway <nconway@@klamath.dyndns.org> for the heads-up.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.10 2000/05/02 20:36:21 thomas Exp $
d9 1
a9 1
 <sect1>
d626 1
a626 1
 <sect1>
@


2.10
log
@Improve section heading for date/time history.
@
text
@d2 1
a2 1
$Header: /usr/local/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.9 2000/05/02 20:01:51 thomas Exp $
d632 1
a632 1
    <ulink url="jose@@sferacarta.com">José Soares</ulink>.
@


2.9
log
@Fixups in content and markup for 7.0 release.
@
text
@d2 1
a2 1
$Header: /usr/local/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.8 2000/03/31 03:27:40 thomas Exp $
d627 1
a627 1
  <title>History</title>
@


2.8
log
@Minor markup changes. Refer to (".../catalog") in the emacs hints.
@
text
@d2 1
a2 1
$Header: /usr/local/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.7 2000/03/29 03:57:10 thomas Exp $
d648 1
a648 1
   <quote>Julian Day</quote> is different from <quote>Julian Date</quote>.
@


2.7
log
@Change rules for interpreting date/time input to disallow 1 and 3 character
 years. Rejects dates like '0.085', which were accepted previously.
Minor mods of ODBC markup.
@
text
@d2 1
a2 1
$Header: /usr/local/cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.6 2000/02/02 16:21:06 thomas Exp $
a3 24

$Log: datetime.sgml,v $
Revision 2.6  2000/02/02 16:21:06  thomas
Add detailed information on Australian time zones.

Revision 2.5  1999/10/12 13:57:04  thomas
Sequence of date interpretation not quite right.

Revision 2.4  1999/06/23 06:17:51  thomas
Clarify input/output timezone information.
Add detail on exact interpretation of "concatenated date"
 for various lengths.

Revision 2.3  1999/05/26 17:30:28  thomas
Add chapters on CVS access, MVCC, SQL theory to the docs.
Add an appendix with more details on date/time attributes and handling.
Update most references to Postgres version numbers to 6.5,
 *except* for the porting list which will require a report
 from a successful installation to be updated.

Revision 2.2  1999/05/22 02:27:23  thomas
Finish initial markup of cvs.sgml, and include it in the programmer's guide
 and the integrated doc. Clean up other markup.

d748 1
a748 1
mode: sgml
d758 1
a758 1
sgml-local-catalogs:"/usr/lib/sgml/catalog"
@


2.6
log
@Add detailed information on Australian time zones.
@
text
@d2 1
a2 1
$Header: /home/cvs/pgsql/doc/src/sgml/datetime.sgml,v 2.5 1999/10/12 13:57:04 thomas Exp $
d6 3
d581 1
a581 1
	If longer than two digits, then interpret as a year.
d608 7
a614 1
	Otherwise, interpret as a year.
d638 4
a641 4
	zeros (e.g. 0099 is 99AD). Three digits are also accepted as a
	year under most circumstances, though depending on position the
	numeric string may
	be interpreted as doy instead.
@


2.5
log
@Sequence of date interpretation not quite right.
@
text
@d2 1
a2 1
$Header: /home/cvs/pgsql/doc/src/sgml/datetime.sgml,v 2.4 1999/06/23 06:17:51 thomas Exp $
d6 3
a424 13
   <note>
    <para>
     If the compiler option USE_AUSTRALIAN_RULES is set 
     then <literal>EST</literal> refers to Australia Eastern Std Time,
     which has an offset of +10:00 hours from UTC.
    </para>

    <para>
     Australian time zones and their naming variants
     account for fully one quarter of all time zones in the 
     <productname>Postgres</productname> time zone lookup table.
    </para>
   </note>
d427 45
a471 1
  <procedure>
d478 74
a551 40
   <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 token contains a colon (":"), this is a time string.
      </para>
     </step>

     <step>
      <para>
       If the token contains a dash ("-"), slash ("/"), or dot ("."),
       this is a date string which may have a text month.
      </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. "19990113" for January 13, 1999)
       or time (e.g. 141516 for 14:15:16).
      </para>
     </step>
     <step>
      <para>
       If the token starts with a plus ("+") or minus ("-"),
       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>
d553 86
a638 116
    <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>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 not found, throw an error.
      </para>
     </step>
    </substeps>
   </step>
   
   <step>
    <para>
     The token is a number or number field.
    </para>

    <substeps>
     <step>
      <para>
       If there are more than 4 digits, 
       and if no other date fields have been previously read, then interpret 
       as a "concatenated date" (e.g. <literal>19990118</literal>). 8
       and 6 digits are interpreted as year, month, and day, while 7
       and 5 digits are interpreted as year, day of year, respectively.
      </para>
     </step>

     <step>
      <para>
       If the token is three digits
       and a year has already been decoded, then interpret as day of year.
      </para>
     </step>
     
     <step>
      <para>
       If longer than two digits, then interpret as a year.
      </para>
     </step>

     <step>
      <para>
       If in European date mode, and if the day field has not yet been read,
       and if the value is less than or equal to 31, then interpret as a day.
      </para>
     </step>

     <step>
      <para>
       If the month field has not yet been read,
       and if the value is less than or equal to 12, then interpret as a month.
      </para>
     </step>

     <step>
      <para>
       If the day field has not yet been read,
       and if the value is less than or equal to 31, then interpret as a day.
      </para>
     </step>

     <step>
      <para>
       Otherwise, interpret as a year.
      </para>
     </step>
    </substeps>
   </step>

   <step>
    <para>
     If BC has been specified, negate the year and offset by one for
     internal storage
     (there is no year zero in the Gregorian calendar, so numerically
     1BC 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 4 digits. If the field was less than 70, then add 2000;
     otherwise, add 1900.

     <tip>
      <para>
       Gregorian years 1-99AD may be entered by using 4 digits with leading
       zeros (e.g. 0099 is 99AD). Three digits are also accepted as a
       year under most circumstances, though depending on position the
       numeric string may
       be interpreted as doy instead.
      </para>
     </tip>
    </para>
   </step>
  </procedure>
@


2.4
log
@Clarify input/output timezone information.
Add detail on exact interpretation of "concatenated date"
 for various lengths.
@
text
@d2 1
a2 1
$Header: /opt/postgres/cvs/pgsql/doc/src/sgml/datetime.sgml,v 2.3 1999/05/26 17:30:28 thomas Exp $
d6 5
d428 6
a436 6
  <para>
   Australian time zones and their naming variants
   account for fully one quarter of all time zones in the 
   <productname>Postgres</productname> time zone lookup table.
  </para>

d491 2
a492 1
       month (e.g. <literal>January</literal>), or noise word (e.g. <literal>on</literal>).
d496 2
a497 2
       For example, set year, month, day for <literal>today</literal>, and additionally
       hour, minute, second for <literal>now</literal>.
d528 1
a528 1
       and 5 digits are interpreted as year, day of year.
d554 1
a554 1
       If in non-European (US) date mode, and if the month field has not yet been read,
d562 1
a562 8
       and if the value is less than or equal to 31, then interpret as a month.
	</para>
       </step>

     <step>
      <para>
       If the month field has not yet been read,
       and if the value is less than or equal to 12, then interpret as a month.
@


2.3
log
@Add chapters on CVS access, MVCC, SQL theory to the docs.
Add an appendix with more details on date/time attributes and handling.
Update most references to Postgres version numbers to 6.5,
 *except* for the porting list which will require a report
 from a successful installation to be updated.
@
text
@d2 1
a2 1
$Header: /opt/postgres/cvs/pgsql/doc/src/sgml/datetime.sgml,v 2.2 1999/05/22 02:27:23 thomas Exp $
d6 7
d26 6
a512 3
     If there are more than 4 digits, 
     and if no other date fields have been previously read, then interpret 
     as a "concatenated date" (e.g. <literal>19990118</literal>).
d514 1
a514 1
    
d520 3
a522 1
       as a "concatenated date" (e.g. <literal>19990118</literal>).
d528 2
a529 1
       If three digits and a year has already been decoded, then interpret as day of year.
d577 4
a580 2
     If BC has been specified, negate the year and offset by one 
     (there is no year zero in the Gregorian calendar).
d589 10
a600 1
   
d615 1
a615 1
   The Julian Day invented by the French scholar
d617 1
a617 1
   and which probably takes its name from the Scaliger's father,
d626 1
a626 1
   Julian Day is different from Julian Date.
d653 1
a653 1
        Every year divisible by 4 is a leap year.
d656 1
a656 1
        However, every year divisible by 100 is not a leap year.
d659 1
a659 1
        However, every year divisible by 400 is a leap year after all.
@


2.2
log
@Finish initial markup of cvs.sgml, and include it in the programmer's guide
 and the integrated doc. Clean up other markup.
@
text
@d2 1
a2 1
$Header$
d5 5
a9 1
$Log$
d12 2
a13 2
<appendix label="UG1" id="datetime-append">
 <title>Date/Time Support</title>
@


2.1
log
@Rearrange and consolidate the Admin Guide.
Add reference pages for utilities and remove standalone chapters for same.
Add material for an appendix on date/time properties, but not yet
 integrated with the User's Guide.
Break up the former chapter on pg_options
 into Admin and Programmer's Guides.
@
text
@d1 621
a621 83
From - Mon May 10 15:59:27 1999
Received: from localhost (lockhart@@localhost [127.0.0.1])
	by localhost (8.8.7/8.8.7) with ESMTP id PAA24871
	for <lockhart@@localhost>; Wed, 14 Apr 1999 15:45:24 GMT
Received: from apop-server.alumni.caltech.edu
	by localhost with POP3 (fetchmail-4.7.9)
	for lockhart@@localhost (single-drop); Wed, 14 Apr 1999 15:45:26 +0000 (UTC)
Received: from bologna.nettuno.it (bologna.nettuno.it [193.43.2.1])
	by alumnus.caltech.edu (8.9.1/8.9.1) with ESMTP id IAA18386
	for <lockhart@@alumni.caltech.edu>; Wed, 14 Apr 1999 08:41:45 -0700 (PDT)
Received: from proxy.sferacarta.com (mail@@sfcabop1.nettuno.it [193.207.10.213])
	by bologna.nettuno.it (8.8.6/8.8.6/NETTuno 3.1) with ESMTP id RAA15888;
	Wed, 14 Apr 1999 17:41:33 +0200 (MDT)
Received: from rosso.sferacarta.com (sferacarta.com) [10.20.30.5] 
	by proxy.sferacarta.com with esmtp (Exim 2.05 #1 (Debian))
	id 10XTfQ-00083Z-00; Wed, 14 Apr 1999 17:41:40 +0000
Message-ID: <3714B6B6.F745D41D@@sferacarta.com>
Date: Wed, 14 Apr 1999 17:39:34 +0200
From: José Soares <jose@@sferacarta.com>
X-Mailer: Mozilla 4.5 [it] (Win95; I)
X-Accept-Language: it
MIME-Version: 1.0
To: Thomas Lockhart <lockhart@@alumni.caltech.edu>
CC: hackers <pgsql-hackers@@postgresql.org>,
        general <pgsql-general@@postgresql.org>
Subject: Re: [GENERAL] Re: [HACKERS] Gregorian Calendar
References: <3711B1E5.80213DF6@@sferacarta.com> <37135951.88FDB948@@alumni.caltech.edu>
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=iso-8859-1
X-UIDL: 25f0580d2a532247ac6af3aee9737b7c
X-Mozilla-Status: 8011
X-Mozilla-Status2: 00000000

Hi Thomas,

Thomas Lockhart ha scritto:

> > I have a question about dates.
> > The Gregorian reform of calendar skiped 10 days on Oct, 1582.
> > This reform was accepted by Great Britain and Dominions (including
> > what is now the USA) only in 1752.
> > If I insert a date that doesn't exist PostgreSQL accepts it.
> > Should it be considered normal ?
>
> As Peter says, this is tricky.
>
> Date conventions before the 19th century make for interesting reading,
> but are not imho consistant enough to warrant coding into a date/time
> handler.
>
> As you probably have noticed, we use Julian date calculations for our
> date/time support.

I suppose you refer to Julian Day invented by the French scholar
Joseph Justus Scaliger (1540-1609)
that probably takes its name from the 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 Day
(JD). JD 0 designates the 24 hours from noon UTC on 1 January 4713 BC
to noon UTC on 2 January 4713 BC.

Julian Day is different from Julian Date

The Julian calendar was introduced by Julius Caesar in 45 BC. It was
in common use until the 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 1 day in approximately 128

and this is why  pope Gregory XIII  in accordance with instructions
from the Council of Trent reformed the calendar to correct this error.

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.

The approximation 365+97/400 is achieved by having 97 leap years
every 400 years.

The Gregorian calendar has 97 leap years every 400 years:
d623 2
d626 2
d629 2
d632 5
d638 2
a639 2
So, 1700, 1800, 1900, 2100, and 2200 are not leap years. But 1600,
2000, and 2400 are leap years.
d641 12
a652 1
instead in the Julian calendar only years divisible by 4 are leap years.
d654 2
a655 12
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 this century.

The reform was observed by Great Britain and Dominions (including what is
now the USA)
in 1752.
The 2 Sep 1752 was followed by 14 Sep 1752.
d657 2
a658 1
This is why unix has the cal 9 1752 like this:
d661 1
a661 1
             1  2 14 15 16
d664 2
d667 45
a711 42
My question is:
^^^^^^^^^^^^

If SQL92 says:

         (Second Informal Review Draft) ISO/IEC 9075:1992, Database
         Language SQL- July 30, 1992

5.3 literals
         22)Within the definition of a <datetime literal>, the <datetime
            value>s are constrained by the natural rules for dates and
times
            according to the Gregorian calendar.
                                     ^^^^^^^^^^^^^^^

Dates between 1752-09-03 and 1752-09-13.
Are they valid dates?
^^^^^^^^^^^^^^^^

> They have the nice property of correctly
> predicting/calculating any date more recent than something like 4013BC
> to far into the future, using the assumption that the length of the
> year is 365.25 days. This is a very recently adopted convention
> (sometime in the 1800s I had thought, but perhaps it was during the
> same "reform" in 1752).
>
> I've toyed with the idea of implementing a Chinese dynastic calendar,
> since it seems to be more predictable than historical European
> calendars.

People's Republic of China uses the Gregorian calendar
for civil purposes. Chinese calendar is used for determining
festivals.

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 B

José



@
