I am working on a project where admin can book an building unit for a customer.And i require that a month lie between two dates of booking or not for calendar.I am using query for this is
"SELECT * FROM rt_booking WHERE rt_unit_id='".$urow['rt_unit_id']."' AND rt_start_date<=".$date11." AND rt_end_date<=".$date22;
Here rt_start_date(unixtimestamp) and rt_end_date(unixtimestamp) is the booking start and end dates.and date11(unixtimestamp) and date22(unixtimestamp) is month starting date and month ending date for a caledar month.
It is working well if the booking start date(rt_start_date) is less more than one month with starting month date(date11) and booking ending date is greater than month ending date.
But if booking date is from 15 january 2012 to 20 january 2012 then it should be selected with for month 'january' from date11=strtotime(01-01-2012) and month end strtotime(31-01-2012);