I was recently surprised to find that EXTRACT's day of the week
authorBruce Momjian <[email protected]>
Tue, 21 Dec 2004 01:02:28 +0000 (01:02 +0000)
committerBruce Momjian <[email protected]>
Tue, 21 Dec 2004 01:02:28 +0000 (01:02 +0000)
numbering is different than TO_CHAR's ditto. EXTRACT starts at 0==Sunday
while TO_CHAR starts at 1==Sunday.

A suggestion for two documentation notes is attached as a patch to
current CVS HEAD.

Troels Arvin

doc/src/sgml/func.sgml

index e336f581c2dc15902a02e4fe10b93ef28f0fe42a..b80c000a21fe630be72b4bdb42f4564ac1d58cc8 100644 (file)
@@ -4412,6 +4412,13 @@ substring('foobar' from 'o(.)b')   <lineannotation>o</lineannotation>
        1230 microseconds = 2.021230 seconds. 
       </para>
      </listitem>
+
+     <listitem>
+      <para><function>to_char</function>'s day of the week numbering
+        (see the 'D' formatting pattern) is different from that of the 
+        <function>extract</function> function.
+      </para>
+     </listitem>
     </itemizedlist>
    </para>
 
@@ -5146,6 +5153,11 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40');
 SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40');
 <lineannotation>Result: </lineannotation><computeroutput>5</computeroutput>
 </screen>
+       <para>
+        Note that <function>extract</function>'s day of the week numbering is 
+        different from that of the <function>to_char</function> function.
+       </para>
+
       </listitem>
      </varlistentry>