The goal is to get a Live Chat link to show on the page during business hours but not show when closed. The following PHP works on our test server but not our client's server. Any ideas why it could work on one and not the other? Both are Apache managed through GoDaddy.
PHP:
<style>
.timeBasedLink {
<?php
date_default_timezone_set('America/Los_Angeles');
$currentTime = date('H:i a');
$openTime = "8:00 am";
$closeTime = "6:00 pm";
$open = DateTime::createFromFormat('H:i a', $openTime);
$close = DateTime::createFromFormat('H:i a', $closeTime);
$open = $open->format('H:i a');
$close = $close->format('H:i a');
if ($currentTime > $open && $currentTime < $close)
{ ?>
display: block;
<?php
}
else
{
?>
display:none;
<?php
}
?>
}
</style>
HTML:
<div class="timeBasedLink">
Put time-sensitive material here.
</div>