Re: [HACKERS] Determining period between 2 dates

2011-02-16 Thread Steve Crawford
On 02/16/2011 09:07 AM, Marti Raudsepp wrote: On Wed, Feb 16, 2011 at 18:03, Thom Brown wrote: For the number of fortnights, that becomes: select extract(epoch from now() - '2010-01-01 11:45:13'::timestamp)/60/60/24/14; You'd think with PostgreSQL having such a rich type system, it wouldn't n

Re: [HACKERS] Determining period between 2 dates

2011-02-16 Thread Marti Raudsepp
On Wed, Feb 16, 2011 at 18:03, Thom Brown wrote: > For the number of fortnights, that becomes: > > select extract(epoch from now() - '2010-01-01 > 11:45:13'::timestamp)/60/60/24/14; > > You'd think with PostgreSQL having such a rich type system, it > wouldn't need to come to that.  It's just aski

Re: [HACKERS] Determining period between 2 dates

2011-02-16 Thread Kevin Grittner
Thom Brown wrote: > For the number of fortnights, that becomes: > > select extract(epoch from now() - '2010-01-01 > 11:45:13'::timestamp)/60/60/24/14; > > You'd think with PostgreSQL having such a rich type system, it > wouldn't need to come to that. It's just asking for the number of > inte

Re: [HACKERS] Determining period between 2 dates

2011-02-16 Thread Thom Brown
On 16 February 2011 15:57, Jan-Benedict Glaw wrote: > On Wed, 2011-02-16 10:52:13 -0500, Robert Haas wrote: >> On Wed, Feb 16, 2011 at 10:47 AM, Thom Brown wrote: >> > I'm wondering what people think of introducing some kind of function >> > to extract the number of units between 2 dates?  At th

Re: [HACKERS] Determining period between 2 dates

2011-02-16 Thread Jan-Benedict Glaw
On Wed, 2011-02-16 10:52:13 -0500, Robert Haas wrote: > On Wed, Feb 16, 2011 at 10:47 AM, Thom Brown wrote: > > I'm wondering what people think of introducing some kind of function > > to extract the number of units between 2 dates?  At the moment there's > > no way to do this.  Take the followin

Re: [HACKERS] Determining period between 2 dates

2011-02-16 Thread Robert Haas
On Wed, Feb 16, 2011 at 10:47 AM, Thom Brown wrote: > Hi all, > > I'm wondering what people think of introducing some kind of function > to extract the number of units between 2 dates?  At the moment there's > no way to do this.  Take the following example: > > Event 1 is '1985-10-26 01:22:00' > E