homepage Welcome to WebmasterWorld Guest from 54.196.24.103
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Visit PubCon.com
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




msg:3053979
 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?

Thanks,
Shawn

 

smatts9




msg:3054004
 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";
else
echo "closed";
?>

Shawn Steele




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

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

Shawn

leadegroot




msg:3055167
 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
gmdate
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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved