Received: from bastuba.partitur.se (bastuba.partitur.se [212.209.169.194]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fATCDRm54194 for ; Thu, 29 Nov 2001 07:13:28 -0500 (EST) (envelope-from kudo@partitur.se) Received: (from root@localhost) by bastuba.partitur.se (8.11.6/8.11.6) id fATCDPd83258 for pgsql-sql@postgresql.org.AVP; Thu, 29 Nov 2001 13:13:25 +0100 (CET) (envelope-from kudo@partitur.se) Received: from tb303.partitur.se (tb303.partitur.se [212.209.169.230]) by bastuba.partitur.se (8.11.6/8.11.6) with ESMTP id fATCDO383250; Thu, 29 Nov 2001 13:13:24 +0100 (CET) (envelope-from kudo@partitur.se) Received: from localhost (localhost [127.0.0.1]) by tb303.partitur.se (8.11.6/8.11.6) with ESMTP id fATCDOI90759; Thu, 29 Nov 2001 13:13:24 +0100 (CET) (envelope-from kudo@partitur.se) Date: Thu, 29 Nov 2001 13:13:24 +0100 (CET) From: Patrik Kudo To: Gary Stainburn cc: pgsql-sql Subject: Re: Fixing faulty dates - select on day part of a date field In-Reply-To: Message-ID: <20011129131110.D86979-100000@tb303.partitur.se> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200111/404 X-Sequence-Number: 5786 Hi 1. You could use date_part(). Try these things select date_part('day', now()); select date_part('month', now()); select date_part('year', now()); 2. Yeah, should be able to do it in one update Regards, Patrik Kudo On Thu, 29 Nov 2001, Gary Stainburn wrote: > Hi all, > > I've got a problem with dates on one of my tables. I've been inserting dates > in the format 'dd/mm/ccyy' which for the days 13-31 for each month worked > fine. > > The problem I have is that for the days 01-12 for each month, the date was > interpretted as 'mm/dd/ccyy'. Now I know about it I need to fix it. > > Two questions. > > 1) how can I select on part of a date? I need to select all records where > the day is not > 12. > 2) can I do this in a single update, i.e. can I do something around > > update calls set xdate = ???? where ??????; > > -- > Gary Stainburn > > This email does not contain private or confidential material as it > may be snooped on by interested government parties for unknown > and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >