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); 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); 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. 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. 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
Archived
This topic is now archived and is closed to further replies.