Jump to content


Photo

time in php4


  • Please log in to reply
2 replies to this topic

#1 runitzme

runitzme
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 29 October 2006 - 05:11 PM

hi i'm new to php and i'm trying to make a script that does certain things every 24 hours, anyone kno how i can do that?

#2 Endrew

Endrew
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 29 October 2006 - 05:33 PM

Heres the logic that i use for my page. Hope its useful.

$datetime = explode(" ",date("Y-m-d H:i:s"));
$date = explode("-",$datetime[0]);
$time = explode(":",$datetime[1]);
if((date("Y")-$date[0]>=1)||(date("m")-$date[1]>=1)||((date("j")-$date[2]>=1)&&(date("His")-implode($time)>=0)))
{
//write here what u want to do after 24hrs
}



#3 brendandonhue

brendandonhue
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 30 October 2006 - 02:06 AM

You can use a cron job to run your script every 24 hours.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users