MySQL Forums
Forum List  »  PHP

How to compare dates ?
Posted by: Tapan Bhanot
Date: November 18, 2005 02:54AM

Hello,

I have 2 dates i.e: Arrival Date and Departure date from user.

Now i have dates in database like same as above. I want to make sure that there's no clash between the dates entered by customer with the dates in database.

For example: If my arrival date is: 10-1-2005 and departure date is: 17-1-2005 and date in db's are:

1. 3-1-2005 to 10-1-2005
2. 11-1-2005 to 18-1-2005
3. 9-1-2005 to 15-1-2005
4. 10-1-2005 to 17-1-2005

So if it compares with date 1 then it should say available but it should say not available when compared with date 2 and 3 and 4.

So there should be no clash of dates at all with the range..provided by user with the dates in db. If there is a clash then say "not available" and if there is no clash then say: "available".

Can someone help me with this ? As i am trying to figure it out for days now and i have reached no where.

Or maybe just tell me the logic on how to check or compare dates for clashes then i will do it.

This is basically a room booking system i am making ...in which there should be no clash in dates so there is no clash of clients.

Any help will be highly appericiated.

Thanks.

Options: ReplyQuote


Subject
Written By
Posted
How to compare dates ?
November 18, 2005 02:54AM
November 18, 2005 02:55AM
November 20, 2005 10:15AM


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.