Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 50FBA632BEB for ; Tue, 5 Jan 2010 21:34:16 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 24076-01 for ; Wed, 6 Jan 2010 01:33:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f213.google.com (mail-gx0-f213.google.com [209.85.217.213]) by mail.postgresql.org (Postfix) with ESMTP id 74360632DC1 for ; Tue, 5 Jan 2010 21:34:05 -0400 (AST) Received: by gxk5 with SMTP id 5so16119479gxk.15 for ; Tue, 05 Jan 2010 17:34:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=fcsWsyaO3xkG0ryDtbf85Rqn1MEx6KkobGlD9/29gN4=; b=PJEC9mtrBAgqdNI7+wkGXHnVm+xA5jiqLujWYEnWhF8tzi2KmXS8QOCZ0svoJwzB2Z bJpPsmVATYNDbgGG03v1MetaiuV4IXs6HQkEd+qZbk+xPeoabqsRtouYYy2CAQxl1eJA dN1kKNC47caAUUV2N2xmPiLKzuybSdEISizTQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=sKtlMrFwzuV19HPAdO6cXVX/pHxwNqJhRe5VZhF5okEFsjdAZ2gRkUaNMPB6t7jhLT l3zPn0W2BydGR8ck8FoEA5/cwXc3hZhXyZSa3EFjRaUyyghagMfvgzp4vbMd4MCr+sIx YeV5HGsiBz+YZlDJvK6NmsGrKN68ROw5BfuNo= Received: by 10.150.4.14 with SMTP id 14mr20336169ybd.168.1262741643877; Tue, 05 Jan 2010 17:34:03 -0800 (PST) Received: from ?192.168.2.65? (office.squiz.net [203.206.128.174]) by mx.google.com with ESMTPS id 21sm19043696iwn.14.2010.01.05.17.34.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 05 Jan 2010 17:34:03 -0800 (PST) Message-ID: <4B43E887.6040402@gmail.com> Date: Wed, 06 Jan 2010 12:33:59 +1100 From: Chris User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: getting extract to always return number of hours Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.401 tagged_above=-10 required=5 tests=AWL=-2.788, BAYES_50=0.001, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/2 X-Sequence-Number: 33538 Hi, I'm trying to get extract() to always return the number of hours between two time intervals, ala: => create table t1(timestart timestamp, timeend timestamp); => insert into t1(timestart, timeend) values ('2010-01-01 00:00:00', '2010-01-02 01:00:00'); => select timeend - timestart from t1; ?column? ---------------- 1 day 01:00:00 (1 row) to return 25 hours. I couldn't see anything in the docs and can't work out a way to do it. Any suggestions? Thanks! -- Postgresql & php tutorials http://www.designmagick.com/