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 990705342C for ; Sun, 3 Apr 2005 21:35:45 +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 54705-02 for ; Sun, 3 Apr 2005 20:35:36 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id D5CBD52952 for ; Sun, 3 Apr 2005 21:35:35 +0100 (BST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1DIBoe-0006q5-00; Sun, 03 Apr 2005 16:35:29 -0400 To: James G Wilkinson Cc: pgsql-sql@postgresql.org Subject: Re: Date/Time Conversion References: <4249ED1F.6080909@alpinegeophysics.com> In-Reply-To: <4249ED1F.6080909@alpinegeophysics.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 03 Apr 2005 16:35:28 -0400 Message-ID: <87sm27r433.fsf@stark.xeocode.com> Lines: 29 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 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.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/36 X-Sequence-Number: 20929 James G Wilkinson writes: > I hope that this is some silly beginner's mistake. I have spent quite a bit of > time > reading the PostgreSQL documentation and cannot find my error. I have also > scanned the PostgreSQL archive and the web for help, but I have not found > anything > to get me over the hump (it is probably out there, I just cannot find it). > > All I am trying to do is convert GMT dates and times to an arbitrary > time zone. Here is my small test database: I think the closest thing to what you're trying to do is: slo=> set timezone = 'GMT'; SET slo=> select '2001-01-01'::date::timestamptz at time zone 'EST' ; timezone --------------------- 2000-12-31 19:00:00 (1 row) Why are you not just storing a "timestamp with timezone" with the actual time of the event, and a second column with the local time zone in which you can choose to use to display the time? -- greg