$time = 100;
intdiv($time, 60) . 'm'.$time % 60 . 's';
You could make a helper method which takes a number of seconds if needed.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
how can i display 100seconds as 1m40s
I wanted to convert the 100s to minutes, that is 100/60. But i'm not sure what to do from there.
$time = 100;
intdiv($time, 60) . 'm'.$time % 60 . 's';
You could make a helper method which takes a number of seconds if needed.
Please or to participate in this conversation.