pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedIs There any function to get Difference of Dates
4+ messages / 3 participants
[nested] [flat]
* Is There any function to get Difference of Dates
@ 2003-01-16 09:36 shreedhar <shreedhar@lucidindia.net>
0 siblings, 3 replies; 4+ messages in thread
From: shreedhar @ 2003-01-16 09:36 UTC (permalink / raw)
To: pgsql-admin
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)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Is There any function to get Difference of Dates
@ 2003-01-16 10:10 shreedhar <shreedhar@lucidindia.net>
parent: shreedhar <shreedhar@lucidindia.net>
2 siblings, 0 replies; 4+ messages in thread
From: shreedhar @ 2003-01-16 10:10 UTC (permalink / raw)
To: pgsql-admin
Hi All,
I got solution from the following link.
http://techdocs.postgresql.org/techdocs/faqdatesintervals.php
Thanks,
Sreedhar
----- Original Message -----
From: "shreedhar" <shreedhar@lucidindia.net>
To: "Postgres" <pgsql-admin@postgresql.org>
Sent: Thursday, January 16, 2003 3:06 PM
Subject: [ADMIN] Is There any function to get Difference of Dates
> 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
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Is There any function to get Difference of Dates
@ 2003-01-16 11:42 Rajesh Kumar Mallah. <mallah@trade-india.com>
parent: shreedhar <shreedhar@lucidindia.net>
2 siblings, 0 replies; 4+ messages in thread
From: Rajesh Kumar Mallah. @ 2003-01-16 11:42 UTC (permalink / raw)
To: shreedhar <shreedhar@lucidindia.net>; pgsql-admin
what abt:
select * from temptbldate WHERE current_date - date(tdate) < CAST ('2 days' AS INTERVAL) ;
?
regds
mallah.
(EXTRACT(EPOCH FROM TIMESTAMP 'now()') -
EXTRACT(EPOCH FROM TIMESTAMP tdate) )/ 86400 < 2
On Thursday 16 January 2003 03:06 pm, 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
--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)
Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Is There any function to get Difference of Dates
@ 2003-01-16 16:54 Steve Crawford <scrawford@pinpointresearch.com>
parent: shreedhar <shreedhar@lucidindia.net>
2 siblings, 0 replies; 4+ messages in thread
From: Steve Crawford @ 2003-01-16 16:54 UTC (permalink / raw)
To: shreedhar <shreedhar@lucidindia.net>; 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
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2003-01-16 16:54 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-16 09:36 Is There any function to get Difference of Dates shreedhar <shreedhar@lucidindia.net>
2003-01-16 10:10 ` shreedhar <shreedhar@lucidindia.net>
2003-01-16 11:42 ` Rajesh Kumar Mallah. <mallah@trade-india.com>
2003-01-16 16:54 ` Steve Crawford <scrawford@pinpointresearch.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox