ankycooper Posted July 3, 2007 Share Posted July 3, 2007 I'm calculating Time Difference (in min) and it is giving me a absurd value $f_clkin=1183405223; $f_clkbrkin=1183405451; $f_clkbrkout=1183440836; $f_clkbrkout=1183441924; $t1=$f_clkbrkout-$f_clkbrkin; $t2=$f_clkout-$f_clkin; $min=$t2-$t1; $min=$min/60; So Now $min has a value of 21.933333333333 min How is it possible?? am i doing something wrong.... :-\ :-\ Please help Quote Link to comment Share on other sites More sharing options...
no_one Posted July 3, 2007 Share Posted July 3, 2007 What value did you expect? <?php $f_clkin=1183405223; $f_clkbrkin=1183405451; $f_clkbrkout=1183440836; /// set here $f_clkbrkout=1183441924; // and here:: why are you setting this 2x? $t1=$f_clkbrkout-$f_clkbrkin; $t2=$f_clkout-$f_clkin; // $f_clkout .. not defined in this code piece $min=$t2-$t1; $min=$min/60; ?> Quote Link to comment Share on other sites More sharing options...
ankycooper Posted July 3, 2007 Author Share Posted July 3, 2007 Sorry There was a Typo But still The Result is absurd <?php $f_clkin=1183405223; $f_clkbrkin=1183405451; $f_clkbrkout=1183440836; /// set here $f_clkout=1183441924; // and here:: why are you setting this 2x? $t1=$f_clkbrkout-$f_clkbrkin; $t2=$f_clkout-$f_clkin; // $f_clkout .. not defined in this code piece $min=$t2-$t1; $min=$min/60; ?> Quote Link to comment Share on other sites More sharing options...
no_one Posted July 3, 2007 Share Posted July 3, 2007 Ok. You still didn't explain what value you expected, and maybe include a little info on what these values $f_* mean and where you got them. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 3, 2007 Share Posted July 3, 2007 Just round the number... Say if you have 80 seconds, that would be 1.3333333 (80/60) minutes as well. It is possible, but it might make more sense to floor it. Quote Link to comment Share on other sites More sharing options...
ankycooper Posted July 3, 2007 Author Share Posted July 3, 2007 as per the time stamps the difference is more than 10 hours so more than 600 min but it does not give the desired results Please Help Quote Link to comment Share on other sites More sharing options...
no_one Posted July 3, 2007 Share Posted July 3, 2007 <?php $f_clkin=1183405223; $f_clkbrkin=1183405451; $f_clkbrkout=1183440836; /// set here $f_clkout=1183441924; // and here:: why are you setting this 2x? $t1=$f_clkbrkout-$f_clkbrkin; $t2=$f_clkout-$f_clkin; // $f_clkout .. not defined in this code piece $smin=$t2-$t1; $min=$smin/60; $td1 = $t1/60; $td2 = $t2/60; print("<p>t1:$t1<br/>td1:$td1<br/>t2:$t2<br/>td2:$td2<br/>td:$smin<br/>$min</p>"); ?> t1: 35385 td1: 589.75 t2: 36701 td2: 611.68333333333 td: 1316 21.933333333333 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.