Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id BA9E52E0084 for ; Tue, 13 May 2008 05:48:37 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 12756-04 for ; Tue, 13 May 2008 05:48:31 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.181]) by developer.postgresql.org (Postfix) with ESMTP id 5FC472E004B for ; Tue, 13 May 2008 05:48:34 -0300 (ADT) Received: by wa-out-1112.google.com with SMTP id n4so3945340wag.5 for ; Tue, 13 May 2008 01:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=8dvovP/Ki1ZYX+3q0HK6p4FzhQ0lCFPVohcDXzjZq8I=; b=HDzOVaWsQscE0CbjSOUX6/ggKDh1Y8ZK+cM41VREvWwgoJy3MCOZth1K/K4sBr1ULXlYV7fxNx70B77yFo2nXMgtHK+i3WMDetcWVFpHG2xi41LWfU4M4Ocn9dI17Y77rntBr2KSj/i/GlLAEftBo/b0ZjvsvyAWVbAlk0ckPj0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=vhxL1EbfeNH95zqpLGyTCIlsHJ4ZFMSRWTUHXFIRAeQXICzklr3Ss859O++HNmq8jFikFbAlrg28z7YME+vtoo0mNE+ZZ7GXRXq+XJtYdMYBTVSFYlMTK/EDaE5AiYJYcBBaOn/EBb4yx6rinBgyQNfwlVhR+aDyCyOKuN9JBHo= Received: by 10.114.147.7 with SMTP id u7mr8861835wad.188.1210668512760; Tue, 13 May 2008 01:48:32 -0700 (PDT) Received: by 10.114.137.7 with HTTP; Tue, 13 May 2008 01:48:32 -0700 (PDT) Message-ID: Date: Tue, 13 May 2008 02:48:32 -0600 From: "Scott Marlowe" To: "Shane Ambler" Subject: Re: how to get a number of seconds in some interval ? Cc: "Achilleas Mantzios" , pgsql-admin@postgresql.org, "Tom Lane" , "Julius Tuskenis" In-Reply-To: <48295481.50800@Sheeky.Biz> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <482849B0.6050103@nsoft.lt> <200805121801.35101.achill@matrix.gatewaynet.com> <20080.1210604951@sss.pgh.pa.us> <200805130956.51872.achill@matrix.gatewaynet.com> <48295481.50800@Sheeky.Biz> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/105 X-Sequence-Number: 29189 On Tue, May 13, 2008 at 2:42 AM, Shane Ambler wrote: > Scott Marlowe wrote: > >> True. But that's only because it doesn't have a date to work against. >> If you run: >> >> select '2007-02-01 12:00:00'::timestamp + '1 month'::interval; >> you get: 2007-03-01 12:00:00 >> >> If you run: >> select '2007-03-01 12:00:00'::timestamp + '1 month'::interval; >> you get: 2007-04-01 12:00:00 >> >> Then, if we run: >> select ('2007-03-01 12:00:00'::timestamp + '1 month'::interval) - >> '2007-03-01 12:00:00'::timestamp; >> we get: 31 days >> >> But if we run: >> select ('2007-02-01 12:00:00'::timestamp + '1 month'::interval) - >> '2007-02-01 12:00:00'::timestamp; >> we get: 28 days >> >> So, I'm not sure how many days a month has. > > Try looking at a calendar.;-) Sorry, didn't realize I'd need to explain my joke. Thought it was pretty obvious. Next time I'll throw a smiley in there.