Welcome to WebmasterWorld Guest from 54.226.133.245

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Time Functions

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

Junior Member

10+ Year Member

joined:Mar 5, 2003
posts:74
votes: 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

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

Junior Member

10+ Year Member

joined:Oct 25, 2005
posts:111
votes: 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";
?>
2:22 pm on Aug 21, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 5, 2003
posts:74
votes: 0


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

Shawn

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 27, 2003
posts:1642
votes: 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 :)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members