From: | "Brandon Aiken" <BAiken(at)winemantech(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Timestamp with timezone query |
Date: | 2006-09-25 22:42:46 |
Message-ID: | F8E84F0F56445B4CB39E019EF67DACBA340758@exchsrvr.winemantech.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hm? Works for me:
postgres=# select time with time zone '00:30:00-05' at time zone 'utc';
timezone
-------------
05:30:00+00
(1 row)
What are you trying to do with the query?
--
Brandon Aiken
CS/IT Systems Engineer
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Harry Hehl
Sent: Monday, September 25, 2006 5:34 PM
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Timestamp with timezone query
Thanks, that does it.
select * from table where column = '2006-02-10 19:30:00' AT TIME ZONE
'utc';
I also have a TIME WITH TIMEZONE column that I have to do the same thing
with but AT TIME ZONE can't be used directly. I tried several approaches
but I either get incorrect results or syntax errors. Is there a way to
do the same thing with TIME columns?
-----Original Message-----
From: Brandon Aiken [mailto:BAiken(at)winemantech(dot)com]
Sent: Monday, September 25, 2006 11:39 AM
To: Harry Hehl; pgsql-general(at)postgresql(dot)org
Subject: RE: [GENERAL] Timestamp with timezone query
Use the AT TIME ZONE construct:
http://www.postgresql.org/docs/8.1/interactive/functions-datetime.html#F
UNCTIONS-DATETIME-ZONECONVERT
--
Brandon Aiken
CS/IT Systems Engineer
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Harry Hehl
Sent: Monday, September 25, 2006 11:06 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] Timestamp with timezone query
Hello,
I have a table with TIMESTAMP WITH TIMEZONE column. I would like to
query for a timestamp using a different timezone.
For example if a column contains '2006-02-11 00:30:00-05'
select * from table where column='2006-02-10 19:30:00+00' would return
the column containing '2006-02-11 00:30:00-05'.
From section 8.5.1.3 "To ensure that a literal is treated as timestamp
with time zone, give it the correct explicit type: TIMESTAMP WITH TIME
ZONE '2004-10-19 10:23:54+02'"
So I tried:
select * from table where column = TIMESTAMP WITH TIME ZONE '2006-02-10
19:30:00+00'
But it did not returned the desired result.
I am getting the timestamp as UTC and want to use to build a query, but
I don't want Postgres convert the timestamp. Is there anyway to do this?
Thanks
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
From | Date | Subject | |
---|---|---|---|
Next Message | Ben | 2006-09-25 23:14:57 | function for longest common substring? |
Previous Message | Tom Lane | 2006-09-25 22:31:39 | Re: in failed sql transaction |