PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ianhull
Forum Contributor
Posts: 310 Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK
Post
by ianhull » Sun Mar 05, 2006 5:52 am
Hi Guys,
Can anyone please guide me through setting a time check in php
I need to check if the time equals 12:00 Local Server Time and if it does refresh a certain frame
something like
Code: Select all
$rtime = time(H:M);
$dorefresh = "12:00";
if ($rtime == $dorefresh)){
echo "refreshcode";
};
etc
Some help to get thisworking will be much appreciated
thanks in advance.
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Sun Mar 05, 2006 5:55 am
Code: Select all
$Time = date("Hi");
if ($Time == 1200) {
// echo "It's 12";
}
That should work. Didn't test it.
ianhull
Forum Contributor
Posts: 310 Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK
Post
by ianhull » Sun Mar 05, 2006 5:57 am
Wow thanks,
Much appreciated.
ianhull
Forum Contributor
Posts: 310 Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK
Post
by ianhull » Sun Mar 05, 2006 6:05 am
Damn, That worked but now i have a little issue with it repeatng until it is 12:01
Could you help me with doing it again but with the seconds?
Would I just add s to the
$Time = date("His"); ?
thanks
ianhull
Forum Contributor
Posts: 310 Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK
Post
by ianhull » Sun Mar 05, 2006 6:09 am
Code: Select all
<?php
$Time = date("His");
if ($Time == 120901) {
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL=">';
}else{
echo "It's not 12 yet";
} ?>
Did the trick
thanks