Welcome to WebmasterWorld Guest from 54.227.52.24

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Time Functions

     

Shawn Steele

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

10+ Year Member



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

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

5+ Year Member



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

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

10+ Year Member



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

Shawn

leadegroot

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

WebmasterWorld Senior Member 10+ Year Member



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 :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month