X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CE9F0540A1 for ; Mon, 25 Apr 2005 08:48:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63626-01 for ; Mon, 25 Apr 2005 11:48:31 +0000 (GMT) Received: from web41010.mail.yahoo.com (web41010.mail.yahoo.com [66.218.93.9]) by svr1.postgresql.org (Postfix) with SMTP id 20AED5409D for ; Mon, 25 Apr 2005 08:48:30 -0300 (ADT) Received: (qmail 89929 invoked by uid 60001); 25 Apr 2005 11:48:33 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=PWdp4XQJETcca+TIeR5IKsT95V3T4PLYe7YQVOxLu4Pc94gOtGPgDVLDillS2TAPayDpDT4ibt/1AxFhCSiTW4v5BtPXdpQD3ralz2cHSwmFbHb+fhOODpE+f1pDcmZ6wsG3FtsbE79i0T9y4KZRELYXmrI/7DdMcBpmhOJwiAc= ; Message-ID: <20050425114833.89927.qmail@web41010.mail.yahoo.com> Received: from [66.108.25.20] by web41010.mail.yahoo.com via HTTP; Mon, 25 Apr 2005 04:48:33 PDT Date: Mon, 25 Apr 2005 04:48:33 -0700 (PDT) From: Theodore Petrosky Subject: Re: to_char(interval) ? To: Bruno Wolff III Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.259 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200504/373 X-Sequence-Number: 21266 This is perfect. select extract(epoch from '1 day 1 hour 15 minute'::interval)/3600 || 'hours'; ?column? ------------ 25.25hours (1 row) I must have looked at this for hours and not seen the 'interval' part of the epoch... Thanks, Ted --- Bruno Wolff III wrote: > On Sun, Apr 24, 2005 at 13:08:04 -0700, > Theodore Petrosky wrote: > > how do I get an interval '1 day 1 hour' to display > as > > '25 hours'. I am hunting in the docs (and > googling) > > and either I am blind or I need a special > function? > > > > Is there an easy way? > > EXTRACT epoch from the interval and divide by 3600 > and concatenate to ' hours'. > > area=> select extract(epoch from '1 day 1 > hour'::interval)/3600 || ' hours'; > ?column? > ---------- > 25 hours > (1 row) > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com