Re: timestamp check - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: timestamp check
Date
Msg-id 55A1538F.5080107@iol.ie
Whole thread Raw
In response to timestamp check  (Ramesh T <rameshparnanditech@gmail.com>)
List 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@iol.ie


pgsql-general by date:

Previous
From: Chris Mair
Date:
Subject: Re: xmltable in postgres like in oracle..?
Next
From: Adrian Klaver
Date:
Subject: Re: xmltable in postgres like in oracle..?