ecabrera Posted April 13, 2015 Share Posted April 13, 2015 ok so here is my code $t = round($seconds); echo sprintf('%02d:%02d:%02d', ($t/3600),($t/60%60), $t%60); the $t is the h m s in seconds i want to just get the minutes so than i can do something like this if($t <= 1500){ $t = 900; } if($t <= 2100){ $t = 1800; } if($t <= 3300){ $t = 2700; } if($t <= 3600){ $t = $t + 216000; } so the result can be something like this 3 hr 15mins 3hr 30min 3hr 45min 4 is this something i can do? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted April 13, 2015 Share Posted April 13, 2015 What are you beginning with? IE, what is $seconds defined as (int,str,datetime?) and what do you store in it? Since you are using a round function I can only assume that it is an integer. Therefore I would assume that you put some kind of unix time into it to start and therefore any date() function should output what you want or allow you to do math on it. What have you tried so far? Quote Link to comment Share on other sites More sharing options...
Solution ecabrera Posted April 13, 2015 Author Solution Share Posted April 13, 2015 i have fixed it i tried ($t/60%60); Quote Link to comment 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.