| From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
|---|---|
| To: | 'PostgreSQL' <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: timestamp check |
| Date: | 2015-07-11 17:34:07 |
| Message-ID: | 55A1538F.5080107@iol.ie |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 10/07/2015 13:54, Ramesh T wrote:
>
> select current_timestamp-to_timestamp(to_char(current_date,'YYYY-MM-DD
> HH24'||':'||'MI'||':'||'SS')||' '||(SELECT utc_offset FROM
> pg_catalog.pg_timezone_names
> WHERE name='US/Eastern'),'YYYY-MM-DD
> HH24'||':'||'MI'||':'||'SS')::timestamptz;
>
> it's not displaying timezone..any help..?
>
Because TIMESTAMPTZ - TIMESTAMPTZ = INTERVAL, not TIMESTAMPTZ.
Also, why on earth are you doing all those string concatenations in the
to_char() calls? Why not just do to_char(..., 'YYYY-MM-DD H24:MI:SS')?
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2015-07-11 17:34:49 | Re: xmltable in postgres like in oracle..? |
| Previous Message | Chris Mair | 2015-07-11 17:30:25 | Re: xmltable in postgres like in oracle..? |