Check if date is between hours interval or week-end. If not, calculate how many hours left until available hour
<p>I need some help if someone would be so kind.
For 2 days I'm squeezing my brains trying to make a script which will inform visitors about tech support online status.</p>

<p>The office hours are from 10AM to 18:30PM.
If the visitor is in this hours interval, it's easy, the message will be "online".
If he's out of the office hours, I need to display the number of hours remaining until tech support will be available and if week-ends or Friday evening, another message will be displayed.</p>

<p>This is my script and I don't really figure where I'm wrong.
Any help appreciated.
Thanks.</p>

<pre><code>$date2 = date("l", time());
$date3 = strtolower($date2);

$now = (int) date('Hi');
$time1 = 1000;
$time2 = 1830;

$currentTime = time();
if (date("G") &gt;= 19 || (date("G") == 18 &amp;&amp; date("i") &gt; 00)) {
$datetime1 = 10 * 3600 + strtotime("now") + (24 - date("G")) * 3600 + 
(60 - date("i")) * 60;
} else {
$datetime1 = strtotime(date("Y-m-d") + " 10:00:00");
}

$interval = abs($datetime1 - $currentTime);
$hours = round($interval / 3600);

if (($date3 == "saturday") || ($date3 == "sunday")) {
$status = '&lt;span style="color:#909090;"&gt;
OFFLINE. We\'ll be available on Monday    morning.&lt;/span&gt;';
} elseif ($date3 == "friday") {
if ($now &gt; $time2) {
    $status = '&lt;span style="color:#909090;"&gt;
OFFLINE. We\'ll be available on     Monday morning.&lt;/span&gt;';
} elseif ($now &lt; $time1) {
    $status = '
&lt;span style="color:#909090;"&gt;OFFLINE. We\'ll be online in about ' . $hours . ' hours.  &lt;/span&gt;';
} else {
    $status = '&lt;span style="color:#32a300;"&gt;ONLINE, solving customer issues. &lt;/span&gt;';
}
} else {
if ($now &gt; $time1 &amp;&amp; $now &lt; $time2) {
    $status = '&lt;span style="color:#32a300;"&gt;ONLINE, solving customer issues.&lt;/span&gt;';
} else {
    $status = '&lt;span style="color:#909090;"&gt;OFFLINE. We\'ll be become online in about ' . $hours . ' hours.&lt;/span&gt;';
}
}

echo $status;
</code></pre>
