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