Skip site navigation (1) Skip section navigation (2)

Re: Times and time zones

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Times and time zones
Date: 2005-07-20 23:36:14
Message-ID: 5.2.1.1.0.20050720193421.03ef54d0@pop6.sympatico.ca (view raw or flat)
Thread:
Lists: pgsql-php
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


In response to

Responses

pgsql-php by date

Next:From: Gavin M. RoyDate: 2005-07-20 23:36:46
Subject: Re: Times and time zones
Previous:From: Lynna LandstreetDate: 2005-07-20 23:27:43
Subject: Times and time zones

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group