Jump to content

Time Difference


ankycooper

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/58184-time-difference/
Share on other sites

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;
?>

Link to comment
https://forums.phpfreaks.com/topic/58184-time-difference/#findComment-288559
Share on other sites

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;


?>

 

Link to comment
https://forums.phpfreaks.com/topic/58184-time-difference/#findComment-288569
Share on other sites

<?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

Link to comment
https://forums.phpfreaks.com/topic/58184-time-difference/#findComment-288592
Share on other sites

Archived

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

×
×
  • 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.