jeff5656 Posted August 8, 2009 Share Posted August 8, 2009 I get this: Vent status update required in: 5.38888888889hrs But I would rather have "5.39 hrs". Is there a way to do this? Thanks! <?php $curr= strtotime("now"); $diff_hr = ($vent_exp-$curr)/3600; $diff_min = ($vent_exp-$curr)/60; if ($diff_hr>1){ echo $diff_hr . "hrs"; } else { echo $diff_min . "mins"; } ?> Link to comment https://forums.phpfreaks.com/topic/169372-solved-truncating-the-time/ Share on other sites More sharing options...
wildteen88 Posted August 8, 2009 Share Posted August 8, 2009 Use floor, ceil, or round Link to comment https://forums.phpfreaks.com/topic/169372-solved-truncating-the-time/#findComment-893698 Share on other sites More sharing options...
jeff5656 Posted August 8, 2009 Author Share Posted August 8, 2009 thanks i did echo round ($diff_hr) and it works great. Link to comment https://forums.phpfreaks.com/topic/169372-solved-truncating-the-time/#findComment-893700 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.