runitzme Posted October 29, 2006 Share Posted October 29, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/25500-time-in-php4/ Share on other sites More sharing options...
Endrew Posted October 29, 2006 Share Posted October 29, 2006 Heres the logic that i use for my page. Hope its useful.[Quote]$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}[/Quote] Quote Link to comment https://forums.phpfreaks.com/topic/25500-time-in-php4/#findComment-116342 Share on other sites More sharing options...
brendandonhue Posted October 30, 2006 Share Posted October 30, 2006 You can use a cron job to run your script every 24 hours. Quote Link to comment https://forums.phpfreaks.com/topic/25500-time-in-php4/#findComment-116541 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.