Re: Time Zone design issues

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Time Zone design issues
Дата
Msg-id 16550.1189396514@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Time Zone design issues  (novnov <novnovice@gmail.com>)
Список pgsql-general
novnov <novnovice@gmail.com> writes:
> At this time my app will be hosted on a server at a single location. Users
> will be updating and viewing from various time zones. I would like to
> present the datetime of the last update to each user according to the time
> zone that they've entered into their profile (stored in the same app db).

This is trivial.  The column should be timestamptz, and you set the
PG timezone parameter to the user's preferred zone within each user's
session.

Under the hood, the data stored in the timestamptz column is "really"
UTC, and conversion to and from the user's preferred zone happens
automatically when the value is input or output.

You should absolutely not try to fake this by skewing the server's
clock, nor by doing "manual" timezone conversions --- any such hack
will lead to great pain.

> What I am not so sure of is how to coordinate the timezones. It seems like a
> complex subject. Most of the timezone data lists include all timezones, with
> all dst variations.

Yeah, there are a lot of 'em :-(  Feel free to filter the set of timezone
names you make visible to your users, if you have a good idea which ones
are really likely to be interesting to them.  There was some discussion
of that a couple weeks ago IIRC.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: novnov
Дата:
Сообщение: Time Zone design issues
Следующее
От: Ron Johnson
Дата:
Сообщение: Re: Time Zone design issues