Hi,
do you use some kind of database to store the booking data (MySQL, PostrgreSQL, Oracle ...) ?
If someone wants to book a book then check if there's already a record where
(existing_start_date/time < new_end_date/time) AND (existing_end_date/time > new_start_date/time)
This should fetch all records that touch the new booking date/time.
Thomas