pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: James G Wilkinson <jgw@alpinegeophysics.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Date/Time Conversion
Date: 03 Apr 2005 16:35:28 -0400
Message-ID: <87sm27r433.fsf@stark.xeocode.com> (raw)
In-Reply-To: <4249ED1F.6080909@alpinegeophysics.com>
References: <4249ED1F.6080909@alpinegeophysics.com>

James G Wilkinson <jgw@alpinegeophysics.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




view thread (5+ messages)

Message-ID: <87sm27r433.fsf@stark.xeocode.com>
Permalink:  ../87sm27r433.fsf@stark.xeocode.com/
Also on:    postgresql.org/message-id/87sm27r433.fsf@stark.xeocode.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gsstark@mit.edu, jgw@alpinegeophysics.com
  Subject: Re: Date/Time Conversion
  In-Reply-To: <87sm27r433.fsf@stark.xeocode.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox