I am writing a program that will allow a user to enter in appointments on a schedule. I am having problems with figuring out how to work out the Calendar objects.

My problem is this. Each appointment needs a start time and ending time and a duration. I am having problems trying to figure out how to check to see if an appointment is already taken.

For example, if someone signs up for an appointment at 1:30pm to 2:30pm. This appointment will have a 60 minute duration. Then someone enters an appointment that starts at 1:45pm.

The two starting times are different as we can plainly see so I cant check to see if appointment times are equal, because they arent. I want to be able to check to see if a starting time of an appointment doesnt conflict with another appointments timeslot. Something like if an appointment start time is somewhere in between another appointments start/end time, dont add it.

I was hoping to get some suggestions or even some code examples of what everyone has done to try to solve this problem. Any help is appreciated.