format time Duration in long value - Android java.util

Android examples for java.util:Date Time

Description

format time Duration in long value

Demo Code


//package com.java2s;

public class Main {
    public static String formatDuration(long duration) {
        long seconds = duration / 1000;
        long minutes = seconds / 60;
        seconds = seconds % 60;//from   w ww .jav a2s  . co  m

        return minutes + "m " + seconds + "s";
    }
}

Related Tutorials