kernelgpf Posted September 4, 2007 Share Posted September 4, 2007 Here's my code- I'm trying to find the difference in hours between one date from another, and my code currently finds the difference in days- could somebody edit the code to use hours instead of days? $expirationdate[0] = $row3[datetillcompletion]; $startdate[0] = date('Y-m-d'); $startdate = strtotime($startdate[0]); $expirationdate = strtotime($expirationdate[0]); $delta = $expirationdate - $startdate; $final=round($delta/86400); Quote Link to comment https://forums.phpfreaks.com/topic/67963-solved-trying-to-find-difference-in-hours-edit-code-from-days-to-hours/ Share on other sites More sharing options...
BlueSkyIS Posted September 4, 2007 Share Posted September 4, 2007 How many seconds in a day? 86400. How many seconds in an hour? 3600: $final=round($delta/3600); Quote Link to comment https://forums.phpfreaks.com/topic/67963-solved-trying-to-find-difference-in-hours-edit-code-from-days-to-hours/#findComment-341602 Share on other sites More sharing options...
kernelgpf Posted September 4, 2007 Author Share Posted September 4, 2007 Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/67963-solved-trying-to-find-difference-in-hours-edit-code-from-days-to-hours/#findComment-341605 Share on other sites More sharing options...
BlueSkyIS Posted September 4, 2007 Share Posted September 4, 2007 eventually you'll have those numbers memorized. Quote Link to comment https://forums.phpfreaks.com/topic/67963-solved-trying-to-find-difference-in-hours-edit-code-from-days-to-hours/#findComment-341607 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.