TIMESTAMP with a timezone offset

From: Madison Kelly <linux(at)alteeve(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: TIMESTAMP with a timezone offset
Date: 2008-12-16 19:16:14
Message-ID: 4947FE7E.30000@alteeve.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I've got a database with a column I CAST as a TIMESTAMP. The data in
the database is GMT.

I want to say in my WHERE clause to offset the value I am giving by X
number of hours and to display the column I've cast as a timestamp
offset by the same X hours.

I am sure this is possible, and probably fairly simple. :)

Here a simplified query I am using that currently has no TZ data:

'bar' is a timestamp from the system, 'baz' is a string from an external
source CAST as a timestamp.

SELECT
foo,
bar,
CAST (baz AS TIMESTAMP) AS last_state_change
FROM
history.table
WHERE
bar >= '2008-12-15 14:01:09' AND foo=153;

Thanks!

Madi

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2008-12-16 19:24:06 Re: TIMESTAMP with a timezone offset
Previous Message Emanuel Calvo Franco 2008-12-16 18:24:33 Re: Trigger/Rules Order of operations