Page 1 of 1

if time()?

Posted: Sun Mar 05, 2006 5:52 am
by ianhull
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.

Posted: Sun Mar 05, 2006 5:55 am
by Benjamin

Code: Select all

$Time = date("Hi");

if ($Time == 1200) {
// echo "It's 12";
}
That should work. Didn't test it.

Posted: Sun Mar 05, 2006 5:57 am
by ianhull
Wow thanks,

Much appreciated.

Posted: Sun Mar 05, 2006 6:05 am
by ianhull
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

Posted: Sun Mar 05, 2006 6:09 am
by ianhull

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