Skip to content

Instantly share code, notes, and snippets.

@arunreddy
Created August 6, 2012 18:47
Show Gist options
  • Save arunreddy/3277482 to your computer and use it in GitHub Desktop.
Save arunreddy/3277482 to your computer and use it in GitHub Desktop.
Seconds to HH MM SS
private String formatIntoHHMMSS(long secondsInput)
{
int hours = (int) (secondsInput / 3600), remainder = (int) (secondsInput % 3600), minutes = remainder / 60, seconds =
remainder % 60;
return ((hours < 10 ? "0" : "") + hours + ":" + (minutes < 10 ? "0" : "") + minutes + ":"
+ (seconds < 10 ? "0" : "") + seconds);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment