title: Unity: How to convert a float value to a 00:00 string?
body: <p>I have a timer that runs in the background and at the end of the level i want to show the leaderboard. i want to take this timer and convert it to 00:00 format 00 (Minutes) : 00 (Seconds) (i.e 01:40). How is that possible? I just need to do the calculations and the convertion when the Level ends. </p>
  
  <p>This is what i have now. i start the timer normally </p>
  
  <pre><code>void Update()
  {
      if(timerIsRunning)
      {
          mainGameTimer += Time.deltaTime;
      }
  }
  </code></pre>
  
  <p>and now to add the timer in the 00:00 format i need to pass it as float but read it as string in the leaderboard </p>
  
  <pre><code>public void ShowResult()
  {
      int min = Mathf.FloorToInt(mainGameTimer / 60);
      int sec = Mathf.FloorToInt(mainGameTimer % 60);
  
      users.Add(new User(userName, score , timeScore));
      users.Sort(delegate (User us1, User us2)
      { return us2.GetScore().CompareTo(us1.GetScore()); });
      int max = users.Count &lt;= 10 ? users.Count : 10;
      for (int i = 0; i &lt; max; i++)
      {
          //leaderListName[i].text = users[i].GetName() + "- " + users[i].GetScore() + "-" + Mathf.RoundToInt(users[i].GetTimeScore()) + "Sec";
          leaderListName[i].text = users[i].GetName();
          leaderListscore[i].text = users[i].GetScore().ToString();
          leaderListtime[i].text = users[i].GetTimeScore().ToString();
      }
  
  }
  
  class User
  {
      string name;
      int score;
      float timeScore;
  
      public User(string _name, int _score , float _timeScore)
      {
          name = _name;
          score = _score;
          timeScore = _timeScore;
      }
      public string GetName() { return name; }
      public int GetScore() { return score; }
      public float GetTimeScore() { return timeScore; }
  }
  </code></pre>