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? Link to comment https://forums.phpfreaks.com/topic/295510-getting-just-the-minutes-by-itself/ 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? Link to comment https://forums.phpfreaks.com/topic/295510-getting-just-the-minutes-by-itself/#findComment-1508928 Share on other sites More sharing options...
ecabrera Posted April 13, 2015 Author Share Posted April 13, 2015 i have fixed it i tried ($t/60%60); Link to comment https://forums.phpfreaks.com/topic/295510-getting-just-the-minutes-by-itself/#findComment-1508929 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.