Here it is... It's not a final solution but maybe it helps.
Database consists of two tables - the first holds info about all hotels,
the second one - about opening and closing time.
create table hotels (
id integer unsigned not null primary key auto_increment,
name varchar(255) not null
);
create table working_time (
hotel_id integer unsigned not null,
open_time integer unsigned not null,
close_time integer unsigned not null
);
For simplify time comparision lets count the time in minutes since Monday.
For example, 5:00AM Monday will be represented as 300 (560 minutes).
5:00AM Tuesday - 1740 (2460+5*60).
So now we have db. "id" field from the first table used in second as "hotel_id".
In the second table you can insert so many open and close times for each hotel as you need.
Now, the PHP code to check what hotels open now:
$current_time = time();
// get day of the week
// note that 0 for Sunday and 6 for Saturday
$dayofweek = (int)date("w",$current_time);
if( $dayofweek == 0 ) {
// Sunday = 7
$dayofweek = 7;
}
$dayofweek--;
// now 0 for Monday and 6 for Sunday
$hour = (int)date("G",$current_time);
$min = (int)date("i",$current_time);
// minutes since Monday
$minutes = $dayofweek*24*60 + $hour*60 + $min;
$sql = "select a.*, b.* from hotels a, working_time b where a.id=b.hotel_id and $minutes >= b.open_time and $minutes <= b.close_time";
After execution $sql query you get all hotels info that woking now.
Hope it helps.