# Convert Milliseconds to Minutes and Seconds in Kotlin

To convert milliseconds to seconds in Kotlin we can just do the math by dividing number of milliseconds first by 1000 then by 60 so we get the number of seconds Then, we calculate the remaining seconds by dividing it to seconds and getting the remainder when divided by 60.```
fun main(args: Array<String>) {
val milliseconds: Long = 1000000
val minutes = milliseconds / 1000 / 60
val seconds = milliseconds / 1000 % 60
println("$milliseconds Milliseconds = $minutes minutes and $seconds seconds.")
}
```

### Output

1000000 Milliseconds = 16 minutes and 40 seconds.