Created
April 29, 2021 00:49
-
-
Save oluwabajio/4451a18bb4a8f589f15ebc5e2170e58d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//time conversion | |
public String timeConversion(long value) { | |
String videoTime; | |
int dur = (int) value; | |
int hrs = (dur / 3600000); | |
int mns = (dur / 60000) % 60000; | |
int scs = dur % 60000 / 1000; | |
if (hrs > 0) { | |
videoTime = String.format("%02d:%02d:%02d", hrs, mns, scs); | |
} else { | |
videoTime = String.format("%02d:%02d", mns, scs); | |
} | |
return videoTime; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment