Jump to content

time and percentages


dragongamer

Recommended Posts

ima trying to create a way of dispalying a percantage of how long some thing has ran for, we have the time its starts at and how long its on for in minutes, when i do try to use it it outputs  54, also i need to find a way of making it to show a percentage, by wotking out how many mintues has been on so far, then with the total time of it.

[code]for($i = 0; $i < 6; $i++){
$string = str_replace('new wbl_pr( "', ' ', $WeatherFields[0][$i]);
$string = ereg_replace('["]', '', $string);
$pieces = explode(",", $string);
echo $pieces[0]." ".$pieces[3]." ".$pieces[2]."mins<br>";

$stime = explode(" ", $pieces[1]);// trying to get the start time

$finish=$stime[1]+$pieces[2];// start time plus how long the programe is in minutes
echo $finish;
}[/code]

http://webzine.dragongamer.net/modules.php?name=TV
has the the information on it.

thanks  ;)
Link to comment
Share on other sites

if you have the length of time it's ran for at a certain point, and the total time it would run for, you could do it like this

[code]
$percent =  round($current_time / $total_time * 100,0);
echo $percent;
[/code]

that should give you a percentage based

hope it helps

Stuie
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.