Skip site navigation (1) Skip section navigation (2)

Intersection of two time segments

From: "Jon Burroughs" <Jon(dot)Burroughs(at)noaa(dot)gov>
To: pgsql-novice(at)postgresql(dot)org
Subject: Intersection of two time segments
Date: 2005-10-07 16:50:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I'm doing some temporal queries in PostgreSQL and am in need of a way to 
find the start/end times for overlapping time segments.

I know about this query, which will tell me whether or not a time 
segment overlaps:
select (timestamp '2001-02-01 0:00', timestamp '2001-09-30 0:00') 
overlaps (timestamp '2001-01-01 0:00', timestamp '2001-04-30 0:00');

But I would like to know the actual start/end times for the overlapping 
segment (i.e. 2002-02-01 to 2001-04-30).  Is there something already 
available that will do that, or do I have to write a function to do this?




pgsql-novice by date

Next:From: operationsengineer1Date: 2005-10-07 17:20:28
Subject: Set Privileges on All Tables (and/or Sequences) at Once
Previous:From: Lee, Patricia S.Date: 2005-10-07 15:21:26
Subject: Adding a template for new platform

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group