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? 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] 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. Link to comment https://forums.phpfreaks.com/topic/25500-time-in-php4/#findComment-116541 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.