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 89B2953482 for ; Mon, 25 Apr 2005 01:04:41 -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 81408-04 for ; Mon, 25 Apr 2005 04:04:33 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 8029A534D4 for ; Mon, 25 Apr 2005 01:03:56 -0300 (ADT) Received: (qmail 3465 invoked by uid 500); 25 Apr 2005 04:23:27 -0000 Date: Sun, 24 Apr 2005 23:23:27 -0500 From: Bruno Wolff III To: Theodore Petrosky Cc: pgsql-sql@postgresql.org Subject: Re: to_char(interval) ? Message-ID: <20050425042327.GA2882@wolff.to> Mail-Followup-To: Bruno Wolff III , Theodore Petrosky , pgsql-sql@postgresql.org References: <20050424200805.49157.qmail@web41010.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050424200805.49157.qmail@web41010.mail.yahoo.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/371 X-Sequence-Number: 21264 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)