Home › Forums › Back End › ‘Open Now’ Time/Date Script › Re: ‘Open Now’ Time/Date Script
September 24, 2010 at 10:40 am
#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.