Re: timestamp with time zone, retrieving input offset/timezone
От | Alban Hertroys |
---|---|
Тема | Re: timestamp with time zone, retrieving input offset/timezone |
Дата | |
Msg-id | 42642E18-4482-4AA9-BB51-BC09B8570A64@solfertje.student.utwente.nl обсуждение исходный текст |
Ответ на | timestamp with time zone, retrieving input offset/timezone ("Der Tung" <dertung@gmx.de>) |
Список | pgsql-general |
On 4 Aug 2009, at 13:09, Der Tung wrote: > But know I have two Users A and B in different timezones. > When A saves a timestamp I want B to: > - Get the timestamp displayed in his timezone > - Get the timestamp displayed in the timezone a originally > saved it in > > Does the type “timestamp with time zone” contain the original > timezone or at least the offset to UTC it was saved in, or does it > just save the UTC time? > > If it saves the timezone/offset, how can I access it? No it doesn't, but if you store User A's timestamp as both a timestamp with time zone and as timestamp witout time zone you should get just the values you're looking for. => select cast(now() at time zone 'CEST' as timestamp without time zone) at time zone 'GMT'; timezone ------------------------------- 2009-08-06 14:15:07.444748+02 (1 row) => select cast(now() at time zone 'CEST' as timestamp with time zone) at time zone 'GMT'; timezone --------------------------- 2009-08-06 10:15:12.66097 (1 row) Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll see there is no forest. !DSPAM:737,4a7aadf610131061822158!
В списке pgsql-general по дате отправления: