Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f55JROE59905 for ; Tue, 5 Jun 2001 15:27:24 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4VJSFE14601 for ; Thu, 31 May 2001 15:28:15 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f4VJLbt74488 for pgsql-sql@postgresql.org; Thu, 31 May 2001 15:21:37 -0400 (EDT) (envelope-from news) From: reinoud@xs4all.nl (Reinoud van Leeuwen) X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Date manipulation Date: Thu, 31 May 2001 19:21:32 GMT Organization: Not organized in any way Lines: 25 Message-ID: <3b1899a5.3897885953@news.xs4all.nl> References: <200105311714.f4VHEbW24511@mail.ldssingles.com> Reply-To: reinoud@xs4all.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@xs4all.nl X-Newsreader: Forte Agent 1.5/32.451 To: pgsql-sql@postgresql.org X-Archive-Number: 200106/41 X-Sequence-Number: 3248 On Thu, 31 May 2001 17:24:54 +0000 (UTC), mark@zserve.com (Mark) wrote: > >How does one perform date manipulation within SQL? For example, SQL >Server has a dateadd() function that takes a date part, scalar, and the >date to manipulate. > >I have a query that determines the number of days that are between now >and a particular date that looks something like this: > >select datediff (dd, now (), column) as difference_in_days from ... > >Anything available short of coding my own function? Yes: see http://www.postgresql.bit.nl/devel-corner/docs/user/functions-formatting.html and http://www.postgresql.bit.nl/devel-corner/docs/user/functions-datetime.html -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud@xs4all.nl http://www.xs4all.nl/~reinoud __________________________________________________