Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting seconds to human readable format MM:SS Java [duplicate]

How can I convert a long int of seconds to the human readable format

MM:SS

Only SS should be 0 padded so

long = 67 -> 1:07
like image 396
Belgin Fish Avatar asked Dec 06 '22 01:12

Belgin Fish


1 Answers

String readable = String.format("%d:%02d", s/60, s%60);
like image 89
Bhesh Gurung Avatar answered Feb 02 '23 01:02

Bhesh Gurung