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 CC55A3A56FD for ; Tue, 11 Jan 2005 22:12:29 +0000 (GMT) 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 88264-10 for ; Tue, 11 Jan 2005 22:12:17 +0000 (GMT) Received: from skycasters.net (ns2.skycasters.com [204.232.30.3]) by svr1.postgresql.org (Postfix) with ESMTP id ECC753A5AC7 for ; Tue, 11 Jan 2005 22:12:18 +0000 (GMT) Received: from rhino.esc1.com [206.71.98.3] by skycasters.net with ESMTP (SMTPD32-8.12) id AF39353C00EE; Tue, 11 Jan 2005 17:12:09 -0500 Received: from rhino.esc1.com (localhost.localdomain [127.0.0.1]) by rhino.esc1.com (8.12.11/8.12.10) with ESMTP id j0BM7SUu012286 for ; Tue, 11 Jan 2005 17:07:28 -0500 Received: from localhost (localhost [[UNIX: localhost]]) by rhino.esc1.com (8.12.11/8.12.11/Submit) id j0BM7Smp012284 for pgsql-sql@postgresql.org; Tue, 11 Jan 2005 17:07:28 -0500 From: Terry Lee Tucker Organization: Enhanced Solutions Computing To: pgsql-sql@postgresql.org Subject: Re: Simple Question Date: Tue, 11 Jan 2005 17:07:28 -0500 User-Agent: KMail/1.5.3 References: <200501111642.21716.terry@esc1.com> In-Reply-To: <200501111642.21716.terry@esc1.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501111707.28773.terry@esc1.com> X-Declude-Sender: terry@esc1.com [127.0.0.1] X-Declude-Spoolname: D4f36353c00eec0ab.SMD X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/45 X-Sequence-Number: 19833 I figured it out. This works: travel_window INTERVAL; drv_time FLOAT; drv_time = miles / 45.0; -- drive time travel_window = quote_literal(drv_time || '' hours''); The variable, travel_window becomes: @ 10 hours 50 mins 40 secs, which is what I wanted. If anybody knows any other ways, I'd be interested in see that too. On Tuesday 11 January 2005 04:42 pm, Terry Lee Tucker saith: > Hello: > > I'm trying to figure out how to convert a floating point value into an > interval of time. I'm calculating the time required to drive from point A > to point B. For the sake of this question, we'll just say it is > miles/speed. So: > > drv_time = 478 / 45.0; > > The value of this is: 10.6222222222222222 > > Is there a way of converting this value to an interval. It seems that > INTERVAL only works with a quoted literal value. > > If I type: > rnd=# select interval '10.8444444444444444 hours'; > interval > ---------------------------- > @ 10 hours 50 mins 40 secs > (1 row) > > Anybody have an pointers? > > Thanks... > > > Work: 1-336-372-6812 > Cell: 1-336-363-4719 > email: terry@esc1.com > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster Work: 1-336-372-6812 Cell: 1-336-363-4719 email: terry@esc1.com