MySQL Forums
Forum List  »  Newbie

Time intervals intersection
Posted by: Ante Drnasin
Date: April 13, 2005 02:28AM

HI there....

I have no idea how to implement this so I need some help....

I'm building an application for project management and for tracking down the hours..every employee must write his activities to this application...

the problem is that I have no idea how to detect if the intervals intersect....
(it would be perfect if this can be calculated with only mysql - the app is coded in PHP otherwise)

In mysql I have two fields(DATETIME) time_start and time_end for each activity entered......

So what I need is to check if intervals intersect...

for example if I want to enter that I've worked from 8:45 - 13:55 on Project 1 ..and if there's another record in db that starts at 12:00 - 15:00 this would throw an error as intervals intersect.....this is pretty easy to implement if you have to compare the entering date with only ONE in db but ofcourse this is not the case.....

so basicly here's a second (more realistic scenario)

Times in DB:
8:00 - 9:45
13:45 - 15:00....

and I want to enter 9:00 - 12:00 which should throw the warning that there's a interval intersection error...

I really do hope I made this clear cause english is not my primary language....

Thanx for any help or pointers....

Oh...I'm using mysql 4.1....

Options: ReplyQuote


Subject
Written By
Posted
Time intervals intersection
April 13, 2005 02:28AM
April 13, 2005 07:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.