X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9A66452A3D for ; Wed, 20 Jul 2005 20:38:07 -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 88163-08 for ; Wed, 20 Jul 2005 23:38:03 +0000 (GMT) Received: from tomts16-srv.bellnexxia.net (tomts16.bellnexxia.net [209.226.175.4]) by svr1.postgresql.org (Postfix) with ESMTP id CC08452A35 for ; Wed, 20 Jul 2005 20:38:02 -0300 (ADT) Received: from acer.sympatico.ca ([65.95.128.226]) by tomts16-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050720233804.YIGG27508.tomts16-srv.bellnexxia.net@acer.sympatico.ca> for ; Wed, 20 Jul 2005 19:38:04 -0400 Message-Id: <5.2.1.1.0.20050720193421.03ef54d0@pop6.sympatico.ca> X-Sender: b1wudu74@pop6.sympatico.ca X-Mailer: QUALCOMM Windows Eudora Version 5.2.1 Date: Wed, 20 Jul 2005 19:36:14 -0400 To: From: Frank Bax Subject: Re: Times and time zones In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.073 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/19 X-Sequence-Number: 3207 At 07:27 PM 7/20/05, Lynna Landstreet wrote: >I've set the datatype for all the time/date columns to timestamp with time >zone, as it seems to be the only type that will store all the data I need, >but I was thrown a bit by the fact that PostgreSQL apparently then converts >all the times to GMT, setting the time zone to +00 accordingly. So if a user >enters July 20, 2005, 6:30 pm EDT (Eastern daylight savings time), it's >saved as 2005-07-20 22:30:00+00 rather than 2005-07-20 18:30:00-04. > >Now, this is fine for comparing different times internally, but it's not so >good for outputting the times back to the user for them to view and edit. >I've now created a second column for each time which saves the time zone >they originally entered, but I'm having trouble converting the time back >from GMT to the original. I need to write a PHP function Why use php when sql will do the job? http://www.postgresql.org/docs/7.4/interactive/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT