homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Time Functions
Shawn Steele

 2:42 am on Aug 21, 2006 (gmt 0)

Can anyone think of a way to display "We're Open", or "We're Closed" on a business website that would automatically display the correct one based upon the current server time?

So for instance, if our business hours were 10am-9pm, the script would check if it's between those hours. If it were, it would display, "We're Open, Call Us at...". And if it were not during those hours, it would display something like "Sorry We're Closed, We'll Open back up at 11am".

Any ideas?




 3:39 am on Aug 21, 2006 (gmt 0)

I'm not great with dates, but hopefully this works out:

$time = date("His");
if($time > "095959")
if($time < "210000")
echo "open";
echo "closed";

Shawn Steele

 2:22 pm on Aug 21, 2006 (gmt 0)

Thank you! Hopefully this works, it will help alot. Thanks again.



 1:45 am on Aug 22, 2006 (gmt 0)

If your server is not in the same timezone as your business then you will need to use the
function instead, so you can offset the time :)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved