Re: Time Zone design issues

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: novnov <novnovice(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Time Zone design issues
Date: 2007-09-10 20:12:26
Message-ID: 20070910201226.GI16512@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-09-10 20:21:00 Re: Time Zone design issues
Previous Message Greg Smith 2007-09-10 19:53:47 Re: archive_command with an environnement variable ?