Jump to content

Archived

This topic is now archived and is closed to further replies.

ego0

Minutes Remaining

Recommended Posts

I Have two dates both in the unix? format

Countdown to date September, 18, 2006, 4:17:00 1158567428

and

date now September 6, 2006, 3:28:51 1157570931

I having trouble making a countdown to the minutes and seconds left from the time the script is run to the countdown date. :( Not a live countdown.

Share this post


Link to post
Share on other sites
i'm not sure i understand the format you're talking of. are the "1158567428" and "1157570931" representative of the times you have? if so, then just try something like this:
[code]
<?php
function getRemainder($time) {
  $now = time();
  $diff = abs($time - $now);
  $res = array(
    'mins' => floor($diff / 3600),
    'secs' => ($diff % 3600)
  );
  return $res;
}

$time = 1158567428; // countdown to
$rem = getRemainder($time);
echo "There are $rem[mins] minutes and $rem[secs] seconds left!";
?>
[/code]

hope this helps

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.