Re: Time Zone design issues - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Time Zone design issues
Date
Msg-id 20070910201226.GI16512@svana.org
Whole thread Raw
In response to Re: Time Zone design issues  (novnov <novnovice@gmail.com>)
List pgsql-general
On Mon, Sep 10, 2007 at 12:44:04PM -0700, novnov wrote:
> What's the postgresql client, in a web app?

Your webapp *is* the postgresql client. The client is whatever opens
the connection to the server.

> When you write "The web app sets timezone='EST5EDT' and inserts a time of
> '2007-07-11 12:30:00'." that's the black box that I'm asking about. There is
> no web app other than the one I am writing. So, I think it means I need to
> write code in my web app to handle the conversion of the postgres stored UTC
> into user-relevant time, with their local time zone etc.

No, you really just send the query "set timezone ='EST5EDT'". You don't
have to code anything special at all. Have you tried this? Just go into
the psql prompt, add some data and switch the timezones around to see
what happens. Your app doesn't need to know anything about the
timezones at all...

> If that's so, what
> I'm asking about is one the webapp side and perhaps people here are not so
> used to dealing with that. I don't know. Just like one of the other (much
> appreciated) responders in this thread suggested, the user's browser is
> likely offering the user's tz info...but I am interested in seeing someone's
> mature system for returning the user's local time based their tz as stored
> in their profile.

The user's browser doesn't send the timezone (probably because there's
no standard way of specifying it). However there is code on the web to
give you a guess though, by using javascript to get time difference
from UTC.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Greg Smith
Date:
Subject: Re: archive_command with an environnement variable ?
Next
From: Alvaro Herrera
Date:
Subject: Re: Time Zone design issues