$d = date("N"); //date as number (monday = 1, sunday = 7) $t = date("G"); //acutal time as number from 1 - 23 switch ($d) { case 7: //sunday closed $output = "closed"; default: if ($t >= 8 && $t <= 11 || $t >= 13 && $t <= 16) { //open from 8.00 to 11.59 and from 13.00 to 16.59 $output = "open"; } else { $output = "closed"; } }; return $output;