How to make a countdown (days) on the site, with every seven days auto-update count? There is a code:
function downcounter($date){ $check_time = strtotime($date) - time(); if($check_time <= 0){ return false; } $days = floor($check_time/86400); $hours = floor(($check_time%86400)/3600); $minutes = floor(($check_time%3600)/60); $seconds = $check_time%60; $str = $days; return $str;
}
//$nextWeek = date("Ymd",time()+7*24*60*60); //$timer = downcounter($nextWeek); $timer = downcounter('2013-02-19 23:59:59');
It looks like you need to make a database and store the date there and if the current system date == the date from the database, then execute: time () + (7 * 24 * 60 * 60) - and record the new date in the database. QUESTION: How to do without a DB, I do not want to do a DB for the sake of one function. ??