Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f16D8Vx74663 for ; Tue, 6 Feb 2001 08:08:31 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from rah.vcsn.com ([207.113.7.1]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f15GuTx33797 for ; Mon, 5 Feb 2001 11:56:29 -0500 (EST) (envelope-from keith@vcsn.com) Received: from localhost (keith@localhost) by rah.vcsn.com (8.9.1a/8.9.1) with ESMTP id LAA16750; Mon, 5 Feb 2001 11:56:49 -0500 Date: Mon, 5 Feb 2001 11:56:49 -0500 (EST) From: To: Karel Zak cc: pgsql-sql@postgresql.org Subject: Re: Problem with Day of Week In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200102/74 X-Sequence-Number: 1247 Ok, so there is actually two standards then. Is this documented anywhere? Is this is something that is going to change? I don't want to write and app and have things "break" during and upgrade :) Thanks for the response. On Mon, 5 Feb 2001, Karel Zak wrote: > > On Mon, 29 Jan 2001, Keith Perry wrote: > > > Greetings, > > > > I notice some talk about date problems and interestingly enough planning > > out an application in which I will need to be able to manipulate dates. > > I notice however that there seems to be a discrepancy with the day or > > week in 7.0.3 > > > > --- > > > > pmhcc=# select date_part('dow','now'::timestamp); > > date_part > > ----------- > > 1 > > (1 row) > > > > pmhcc=# select to_char('now'::timestamp,'D'); > > to_char > > --------- > > 2 > > (1 row) > > > > See: > > test=# select date_part('dow','2001-02-11'::timestamp); > date_part > ----------- > 0 > > test=# select to_char('2001-02-11'::timestamp, 'D'); > to_char > --------- > 1 > > > date_part is based on zero - use range 0-6 > to_char is based on one - use range 1-7 > > Karel >