0
function crimemaketime($until){

   $now = time();
   $difference = $until - $now;

   $days = floor($difference/86400);
   $difference = $difference - ($days*86400);

   $hours = floor($difference/3600);
   $difference = $difference - ($hours*3600);

   $minutes = floor($difference/60);
   $difference = $difference - ($minutes*60);

   $seconds = $difference;
   $output = "$minutes Minutes and $seconds Seconds";

   return $output;

   }

Hi, im looking to set and interval so that no refreshing is need for my timers.

This i have above works fine for my output, but im unable to get it to work with setinterval.

ive searched the internet for a good few hours and nothing has seemed to work or maybe im doing something wrong.

Any help is appreciated, many thanks.

  • have a look here http://stackoverflow.com/questions/8273804/convert-seconds-into-days-hours-minutes-and-seconds – andrew Apr 06 '14 at 13:05
  • Have a look at the PHP 'date_diff' function and the examples in the comments. – WhoIsRich Apr 06 '14 at 13:08
  • @andrew, thanks for the comment, unfortunately i couldn't find anything to do with setinterval on that page? – user3499569 Apr 06 '14 at 13:10
  • are you referring to javascript setInterval? you could either keep reloading the page with js which would be nasty or use ajax. You tagged javascript but you don't post any javascript code – andrew Apr 06 '14 at 13:22
  • @andrew my apologies, im a bit confused on what im doing. Im not actually to sure on what language i should use, ive seen: setInterval(function,milliseconds,lang) mentioned many times but unable to get this working. – user3499569 Apr 06 '14 at 13:29

0 Answers0