pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: shreedhar <shreedhar@lucidindia.net>
To: Postgres <pgsql-admin@postgresql.org>
Subject: Is There any function to get Difference of Dates
Date: Thu, 16 Jan 2003 15:06:32 +0530
Message-ID: <00a201c2bd42$c10b4e30$1201a8c0@a4005> (raw)

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)




view thread (4+ messages)  latest in thread

Message-ID: <00a201c2bd42$c10b4e30$1201a8c0@a4005>
Permalink:  ../00a201c2bd42$c10b4e30$1201a8c0@a4005/
Also on:    postgresql.org/message-id/00a201c2bd42$c10b4e30$1201a8c0@a4005

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: shreedhar@lucidindia.net
  Subject: Re: Is There any function to get Difference of Dates
  In-Reply-To: <00a201c2bd42$c10b4e30$1201a8c0@a4005>
  References: <00a201c2bd42$c10b4e30$1201a8c0@a4005>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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