Skip to content

Instantly share code, notes, and snippets.

@leventeren
Created October 6, 2020 20:25
Show Gist options
  • Save leventeren/43722ca13676048dc00c7c74de805749 to your computer and use it in GitHub Desktop.
Save leventeren/43722ca13676048dc00c7c74de805749 to your computer and use it in GitHub Desktop.
public static string GetMinuteTime(float time)
{
int mm,ss;
string stime = "0:00";
if (time<=0) return stime;
mm = (int)time/60;
ss = (int)time%60;
if(mm>60)
stime = "59:59";
else if (mm <10 && ss >=10)
{
stime = "0" + mm + ":" + ss;
}else if (mm<10&&ss<10)
{
stime = "0"+mm+":0"+ss;
}else if (mm>=10&&ss<10)
{
stime = mm+":0"+ss;
}
else
{
stime= mm+":"+ss;
}
return stime;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment