| From: | Anson Abraham <anson(dot)abraham(at)gmail(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | querying a column w/ timestamp with timezone datatype |
| Date: | 2012-01-30 15:00:14 |
| Message-ID: | CAC9g-He80+W8fjMBZcN_8Gn5VM1Pb7_5BdjR2COdJqC3dEWH4w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
I an 9.1 PG database: I have a column which is a timestamp w/ time zone.
So the value I have as one record in table is: 15:55:24.342848+00
If i want to find records less or greater than that timestamp, how do I
construct the query?
select * from schema.table where tscol >= '15:55:24.342848+00';
select * from schema.table where tscol >= '15:55:24.342848+00'::timestamp;
select * from schema.table where tscol >= cast('15:55:24.342848+00' as
timestamp with time zone);
do not work. Do I have to convert the value to a string and substr to
15:55:24 and then convert back to a timestamp? It's been a long while since
I had to query a pg table w/ a timestamp with time zone value. Any help
here would be appreciated.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Steve Crawford | 2012-01-30 18:09:57 | Re: querying a column w/ timestamp with timezone datatype |
| Previous Message | Rehan Saleem | 2012-01-30 06:42:51 | MS-SQL Store Procedure to Postgresql Function |