Re: timestamp check

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Ramesh T <rameshparnanditech(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: timestamp check
Date: 2015-07-13 14:05:48
Message-ID: 55A3C5BC.2090905@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/11/2015 11:21 PM, Ramesh T wrote:
> postgres query
> select current_timestamp-
> TO_TIMESTAMP(to_char(DATE1, 'YYYY-MM-DD HH24'|| ' '||'MI'||' '||'SS')||'
> '||(SELECT utc_offset FROM pg_catalog.pg_timezone_names
> WHERE name=DATETIMEZOZE1) , ''YYYY-MM-DD HH24'||' '||'MI'||'
> '||'SS')::timestamptz
>
> getting result..

First there is no indication of what DATE1 and DATETIMEZOZE1 are, so the
result you show has no context.

Second why are you doing all this? You are taking a timestamp (I
presume) converting it to a string and then converting it back to a
timestamp, just to to timestamp subtraction.

From what I can piece together you seem to be wanting to get the
interval between two timestamps, is this correct?

Is so or if not, show us a schematic representation of what you are
trying to achieve. For example:

'07/13/2015 07:03:15'::timestamp - '01/01/2015 14:15:00'::timestamp

= interval in days, hours, etc

>
> Inline image 1
>
>
> But in oracle using systimestamp,to_timestamptz and SS TZH is not
> supporting to_timestamp in postgres.
>
> result..
>
> Inline image 2
>
> diffrence is days displaying in postgres query..i thnk something wrong.
> is it..?
>
> any help apprictiated.
>
>
>
>
>
>
> On Sat, Jul 11, 2015 at 11:12 PM, Adrian Klaver
> <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
>
> On 07/10/2015 05:54 AM, 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..?
>
>
> Forget my previous post, Rays post made me realize the error of my
> ways, namely thinking current_timestamp-to_timestamp was a function.
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2015-07-13 14:09:32 Re: timestamp check
Previous Message Ramesh T 2015-07-13 11:54:55 Re: xmltable in postgres like in oracle..?