From: | Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl> |
---|---|
To: | Der Tung <dertung(at)gmx(dot)de> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: timestamp with time zone, retrieving input offset/timezone |
Date: | 2009-08-06 10:18:27 |
Message-ID: | 42642E18-4482-4AA9-BB51-BC09B8570A64@solfertje.student.utwente.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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!
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2009-08-06 10:30:42 | Re: LDAP Configuration for Postgres authenticating against AD |
Previous Message | Abraham, Danny | 2009-08-06 10:14:03 | Re: InitDB 8.3.7 fails on Windows - Failed system call was MapViewOfFileEx |