All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.com.bselzer.ktx.datetime.format.Duration.kt Maven / Gradle / Ivy

The newest version!
package com.bselzer.ktx.datetime.format

import kotlin.time.Duration

/**
 * Formats the duration into a user friendly representation with minutes as the highest unit.
 *
 * @see formatting
 */
actual fun Duration.minuteFormat(): String {
    val totalSeconds = inWholeSeconds
    val seconds: Int = (totalSeconds % 60).toInt()
    val minutes: Int = (totalSeconds / 60).toInt()
    return "%01d:%02d".format(minutes, seconds)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy