mattichu Posted March 1, 2012 Share Posted March 1, 2012 hii I have made some code that works out the difference between two timecodes. IE Time 1 Time 2 Time2-Time1 1330613232 - 1330613545 = 313 Im wanting to express the difference in terms of hours. 313 as a time code is 00:06:49 but I want it to show 0.12 hours. how would I achieve this? x Quote Link to comment https://forums.phpfreaks.com/topic/258049-timecode-expressed-in-hours/ Share on other sites More sharing options...
scootstah Posted March 1, 2012 Share Posted March 1, 2012 313 / 3600 (seconds in an hour) = 0.0869444444 hours Not sure where you got .12 from. Quote Link to comment https://forums.phpfreaks.com/topic/258049-timecode-expressed-in-hours/#findComment-1322754 Share on other sites More sharing options...
mattichu Posted March 1, 2012 Author Share Posted March 1, 2012 blonde moment many thanks! Quote Link to comment https://forums.phpfreaks.com/topic/258049-timecode-expressed-in-hours/#findComment-1322755 Share on other sites More sharing options...
blacknight Posted March 1, 2012 Share Posted March 1, 2012 number_format(abs(($time1-$time2)/60/60), 2, '.', '') shold show hours... Quote Link to comment https://forums.phpfreaks.com/topic/258049-timecode-expressed-in-hours/#findComment-1322756 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.