Hi Tryingtolearn,
I really appreciate the code above. I'm trying to modify the last part of the code to only add an email recipient if it's outside of the start and end time and only on Saturday and Sunday.
This is what I came up with.
$offDays = array('Sunday', 'Saturday');
//Business Hours
$date = date_create(date('Y-m-d'));
$setNow = date_time_set($date, date('H'),date('i'),date('s'));
$nowTime = date_format($setNow, 'Y-m-d H:i:s');
$setStart = date_time_set($date, 6, 0, 0);
$startTime = date_format($setStart, 'Y-m-d H:i:s');
$setStop = date_time_set($date, 17, 0, 0);
$stopTime = date_format($setStop, 'Y-m-d H:i:s');
if(($nowTime < $startTime && $nowTime > $stopTime) OR (in_array(date('l'), $offDays))
{
$mail->addAddress('
[email protected]', 'My Name');
}