ramli Posted March 25, 2007 Share Posted March 25, 2007 I am traying to calculate time. i have the following script. while ... loop { $diftot = strtotime($dif); $subtotal = $subtotal + $diftot; } function timecalc($var1,$var2,$method) { $varmktime = $var1; $varmktime = time_int($varmktime); $varmktime = ($varmktime['uur'].":".$varmktime['minuut'].":".$varmktime['seconde']); // 0:0:0 convert to 00:00:00 $tijdstukken = explode(":", $varmktime); $varmktime = date("H:i:s", mktime($tijdstukken[0], $tijdstukken[1], $tijdstukken[2])); $var['mktime'] = $varmktime; return $var; } $subtotal = timecalc($subtotal,'0','mktime'); echo($subtotal['mktime']); I have created a while loop where all enterys are added to eatchother. i inputted: diferrence 1: 00:00:07 is 1174777207 difference 2: 00:00:03 is 1174777203 Total is : 2349554410 milliseconds But when i try to calculate the total it outputs 22:00:10 insted of 00:00:10. Can anybody help me with this problem please. Thx in advance.... Link to comment https://forums.phpfreaks.com/topic/44228-solved-calculating-with-time-timeerror/ Share on other sites More sharing options...
kenrbnsn Posted March 25, 2007 Share Posted March 25, 2007 The numbers you're getting are not in milliseconds, each number is the number of seconds elapsed since January 1, 1970. If you can explain what you're trying to do, maybe we can come up with a solution. Ken Link to comment https://forums.phpfreaks.com/topic/44228-solved-calculating-with-time-timeerror/#findComment-214834 Share on other sites More sharing options...
ramli Posted March 26, 2007 Author Share Posted March 26, 2007 Dont bother your comment made me realise my mistake. Many Thanx for your help. Link to comment https://forums.phpfreaks.com/topic/44228-solved-calculating-with-time-timeerror/#findComment-215521 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.