Re: Date/Time Conversion

From: Greg Stark <gsstark(at)mit(dot)edu>
To: James G Wilkinson <jgw(at)alpinegeophysics(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Date/Time Conversion
Date: 2005-04-03 20:35:28
Message-ID: 87sm27r433.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

James G Wilkinson <jgw(at)alpinegeophysics(dot)com> writes:

> I hope that this is some silly beginner's mistake. I have spent quite a bit of
> time
> reading the PostgreSQL documentation and cannot find my error. I have also
> scanned the PostgreSQL archive and the web for help, but I have not found
> anything
> to get me over the hump (it is probably out there, I just cannot find it).
>
> All I am trying to do is convert GMT dates and times to an arbitrary
> time zone. Here is my small test database:

I think the closest thing to what you're trying to do is:

slo=> set timezone = 'GMT';
SET
slo=> select '2001-01-01'::date::timestamptz at time zone 'EST' ;
timezone
---------------------
2000-12-31 19:00:00
(1 row)

Why are you not just storing a "timestamp with timezone" with the actual time
of the event, and a second column with the local time zone in which you can
choose to use to display the time?

--
greg

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Axel Straschil 2005-04-03 20:36:57 Re: How to store directory like structures?
Previous Message PFC 2005-04-03 19:57:29 Re: How to store directory like structures?