pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Richard Sydney-Smith <richard@ibisaustralia.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Date interval
Date: Fri, 26 Sep 2003 07:57:50 +0200
Message-ID: <3F73D55E.6030405@klaster.net> (raw)
In-Reply-To: <002901c383ed$a70423a0$8f601ad3@athlon2000>
References: <002901c383ed$a70423a0$8f601ad3@athlon2000>

> I am looking for a way to convert an interval into a number of days ( 
> integer);
>  
> In sybase I would use :
>  
> days(today()-r_expire)
>  
> where r_expire is the timestamp I am comparing against.
>  
> How do we do this in postgres?
>  
> date_trunc(today()-r_expire) does not seem to do it

select extract(epoch from some_interval)/3600/24::integer

Regards,
Tomasz Myrta




view thread (8+ messages)  latest in thread

Message-ID: <3F73D55E.6030405@klaster.net>
Permalink:  ../3F73D55E.6030405@klaster.net/
Also on:    postgresql.org/message-id/3F73D55E.6030405@klaster.net

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, richard@ibisaustralia.com
  Subject: Re: Date interval
  In-Reply-To: <3F73D55E.6030405@klaster.net>

* 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