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 E5EC8329EBD for ; Mon, 4 Oct 2004 00:32:39 +0100 (BST) 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 99996-06 for ; Sun, 3 Oct 2004 23:32:36 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 6517D329EB8 for ; Mon, 4 Oct 2004 00:32:38 +0100 (BST) Received: (qmail 25661 invoked by uid 500); 3 Oct 2004 23:42:43 -0000 Date: Sun, 3 Oct 2004 18:42:43 -0500 From: Bruno Wolff III To: Jens Arnfelt Cc: pgsql-sql@postgresql.org Subject: Re: How to convert 3 colums to timestamp with timezone Message-ID: <20041003234243.GB24542@wolff.to> Mail-Followup-To: Jens Arnfelt , pgsql-sql@postgresql.org References: <41606605.9040704@cuatro.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41606605.9040704@cuatro.dk> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/17 X-Sequence-Number: 19120 On Sun, Oct 03, 2004 at 22:50:13 +0200, Jens Arnfelt wrote: > Hi There! > > Hope this is an easy one :-D > > How do I convert 3 individuel colums with type "date", "time" and > "integer" to at timestamp with timexone? > > eg. tabel > cStartUnixtime cStartTime cStartZone > 09-24-2004 10:27:12 -2 > > This I have to present as an timestamp with timezone. You can add the date and time to get a timestamp and then use AT TIME ZONE with the second argument being the integer times an interval of 1 hour. Sort of like the following: bruno=> select ('2004-9-24'::date + '10:27:12'::time) at time zone (-2 * '1 hour'::interval); timezone ------------------------ 2004-09-24 07:27:12-05 (1 row)