Jump to content

[SOLVED] truncating the time


jeff5656

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.