Jump to content

Minutes Remaining


ego0

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.
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.