Re: 'NOW' in UTC with no timezone

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-general(at)postgresql(dot)org
Subject: Re: 'NOW' in UTC with no timezone
Date: 2004-10-12 16:17:59
Message-ID: 20041012161759.GE4721@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 12, 2004 at 10:43:09AM -0400, Tom Lane wrote:
> Greg Stark <gsstark(at)mit(dot)edu> writes:
> > I guess my confusion comes from the way postgres interprets unadorned time
> > stamps as being in local time. And then always displays timestamps converted
> > to local time. I thought it was remembering the time zone specified in the
> > original input. In fact it's not doing that.
>
> Indeed not. (I think that the SQL spec contemplates that TIMESTAMP WITH
> TIME ZONE *should* work that way, but that's not what we've done.)

In something I'm working on at the moment I've settled on storing the
timestamp and the timezone in seperate columns. The reason is that it
really needs to represent time in a particular timezone. The operation
of adding one day to a timestamp is dependant on a particular timezone
due to daylight savings. If everything is always rotated to your
current timezone the results will just be wrong...

Since PostgreSQL doesn't actually support daylight savings timezones
I'm going to do the processing in the application. I'd consider adding
it to PostgreSQL too except this needs to work on pre-8.0 systems.

Maybe what is needed is a TIMESTAMP WITH FIXED TIME ZONE type :)

Have a nice day,
--
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 Eric D Nielsen 2004-10-12 16:20:46 Re: Need some advice on appropriate PL strategy... ["solved/thanks"]
Previous Message Jeff Boes 2004-10-12 16:15:09 Re: Rule uses wrong value