Re: TIMESTAMP vs TIMESTAMP WITHOUT TIME ZONE

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: juleni(at)livetrade(dot)cz
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: TIMESTAMP vs TIMESTAMP WITHOUT TIME ZONE
Date: 2005-11-10 16:20:41
Message-ID: 20051110162039.GE19686@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Nov 10, 2005 at 04:37:36PM +0100, juleni(at)livetrade(dot)cz wrote:
> Hello,
>
> I have question about functionality for TIMESTAMP (with/without time zone).
> The main question is, what is better for usage: timemestamp WITH or WITHOUT
> time zone?
>
> I have e.g. server in USA and there is 6:00 a.m. Then I have client somwhere in
> Europe (+7 hour) and I read timestamp from server in USA.

They serve different purposes. A timestamp without timezone is for
storing times values you want to appear the same to everyone no matter
where they are. A timestamp with timezone reprentents and instant in
time and will be converted to the time appropriate for the local user.

So it all depends on what you want. You can convert between them:

my_timestamp_with_timezone AT TIME ZONE 'Europe/Amsterdam'

returns that the wallclock time of that timestamp as it was in
Amsterdam then.

The other way works too.

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-11-10 16:28:17 Re: TIMESTAMP vs TIMESTAMP WITHOUT TIME ZONE
Previous Message Scott Marlowe 2005-11-10 16:16:33 Re: Best way to use indexes for partial match at