Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What will be the ideal method to convert the milliseconds to minutes in Kotlin

In Kotlin, what will be the appropriate way of converting milliseconds (in Long type) to minutes?

like image 728
Shivaprasad Bhat Avatar asked Oct 28 '25 14:10

Shivaprasad Bhat


1 Answers

You can use TimeUnit class which can convert different time units:

TimeUnit.MILLISECONDS.toMinutes(milliseconds)
TimeUnit.SECONDS.toMillis(seconds)
like image 173
Autocrab Avatar answered Oct 31 '25 13:10

Autocrab



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!