Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End ‘Open Now’ Time/Date Script Re: ‘Open Now’ Time/Date Script

#79113
Bob
Member

Here’s an easy example:



if ( date("w") == 5 ) {
echo "Sorry, the internet is closed today!";
}
else {
echo "Open for business!";
}

?>

Explanation: the code first checks if today’s day number of the week (from 1-7), equals 5 (=friday). If that is so, it will show the text Sorry, the internet is closed today. If it isn’t 5, it will show the text Open for business!
Ofcourse, this code can be extended, but it should get you started.