Php: if now is business hours echo "we are open!"

Hello,

I want to use php to put a note on a site saying “we are open, call now” (or whatever) if the time is between 7:30am and 4:00pm Monday to Friday.

Any help/direction is much appreciated.
Thanks!
Ida

http://us2.php.net/manual/en/function.date.php


if ( (int)date( 'N' ) < 6 ) {
    $h = (int)date( 'G' );
    if ( $h >= 7 && $h <= 16 ) {
        print 'Open!';
    }
}

Course I skipped the minutes on purpose. I leave that to you.

Take a look at the documentation on php.net for the date function - that has lots of information on how to get day of the week, current hour, minute, second etc.

Just remember that if you are only open for a few hours each day that you will always appear to be closed to those people who are always asleep during those hours.

Don’t forget holidays. It reflects badly if you say you are open during a holiday and you aren’t.

Just change your message to “We are probably open” and the holiday issue will be taken care of. Most of the time.

Holiday wont be an issue if he adds on the script what days his shop will be closed for say um the next year.

Thanks! Worked perfect.