pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Jens Arnfelt <jens.arnfelt@cuatro.dk>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to convert 3 colums to timestamp with timezone
Date: Sun, 3 Oct 2004 18:42:43 -0500
Message-ID: <20041003234243.GB24542@wolff.to> (raw)
In-Reply-To: <41606605.9040704@cuatro.dk>
References: <41606605.9040704@cuatro.dk>

On Sun, Oct 03, 2004 at 22:50:13 +0200,
  Jens Arnfelt <jens.arnfelt@cuatro.dk> wrote:
> Hi There!
> 
> Hope this is an easy one :-D
> 
> How do I convert 3 individuel colums with type "date", "time" and
> "integer" to at timestamp with timexone?
> 
> eg.   tabel
> cStartUnixtime    cStartTime    cStartZone
> 09-24-2004    10:27:12    -2
> 
> This I have to present as an timestamp with timezone.

You can add the date and time to get a timestamp and then use AT TIME ZONE
with the second argument being the integer times an interval of 1 hour.
Sort of like the following:
bruno=> select ('2004-9-24'::date + '10:27:12'::time) at time zone (-2 * '1 hour'::interval);
        timezone
------------------------
 2004-09-24 07:27:12-05
(1 row)



view thread (2+ messages)

Message-ID: <20041003234243.GB24542@wolff.to>
Permalink:  ../20041003234243.GB24542@wolff.to/
Also on:    postgresql.org/message-id/20041003234243.GB24542@wolff.to

 · 

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: bruno@wolff.to, jens.arnfelt@cuatro.dk
  Subject: Re: How to convert 3 colums to timestamp with timezone
  In-Reply-To: <20041003234243.GB24542@wolff.to>

* 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