Re: Is There any function to get Difference of Dates

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: "shreedhar" <shreedhar(at)lucidindia(dot)net>, "Postgres" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Is There any function to get Difference of Dates
Date: 2003-01-16 16:54:42
Message-ID: 20030116165441.BEC0C103DE@polaris.pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Have you tried age(now(), tdate)? Or just:
.....where now()-tdate < '2 days'

Cheers,
Steve

On Thursday 16 January 2003 1:36 am, shreedhar wrote:
> Hi All,
>
> Is There any function to get Difference of Dates.
>
> Here tdate is of type timestamp
>
> If I tried
>
> select * from temptbldate WHERE (EXTRACT(EPOCH FROM TIMESTAMP 'now()') -
> EXTRACT(EPOCH FROM TIMESTAMP tdate) )/ 86400 < 2
> I got error as 'Parse error at tdate'
>
> select * from temptbldate WHERE (EXTRACT(EPOCH FROM TIMESTAMP 'now()') -
> EXTRACT(EPOCH FROM TIMESTAMP 'tdate') )/ 86400 < 2
> If I use 'tdate', I got 'bad timestamp external representation 'tdate',
> Probably it might be taking 'tdate' as string.
>
> How can I use epoch to get difference of two dates.
>
> Regards,
> Sreedhar
>
>
> "Faith, faith, faith in ourselves, faith, faith in God, this is the secret
> of greatness.
> If you have faith in all the three hundred and thirty millions of your
> mythological gods,
> and in all the gods which foreigners have now and again introduced into
> your midst,
> and still have no faith in yourselves, there is no salvation for you. "
> (III. 190)
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Christopher Smith 2003-01-16 17:31:28 asynchronous psql command options?
Previous Message jtrumbo 2003-01-16 15:56:48 database monitoring tool availability