title: How to convert a float into time?
body: <p>As an example lets say I have <code>float total_Time = 228.10803</code> what I want is to convert <code>total_Time</code> into a time format so it would look like this <code>00:03:48</code> how would I do that?</p>
  
  <p>I thought of writing it like this:</p>
  
  <pre><code>{
  
      float total_Time = 0;
      float h = 0;
      float m = 0;
      float s = 0;
  
      br.BaseStream.Position = i + 4;
      total_Time = br.ReadSingle(); //reads 228.10803
      total_Time = Convert.ToSingle(Math.Round(total_Time, 0));
      if (total_Time &lt; 3600)
      {
          h = 0;
      }
      else
      {
          h = total_Time / 3600;
          h = Convert.ToSingle(Math.Round(h, 0));
          total_Time = total_Time - (h * 3600);
      }
      m = total_Time / 60;
      m = Convert.ToSingle(Math.Round(m, 0));
      total_Time = total_Time - (m * 60);
      s = total_Time;
      s = Convert.ToSingle(Math.Round(s, 0));
      SaveCS_PlayTime.Text = String.Format("Play Time: {0}:{1}:{2}", h, m, s);
  }
  </code></pre>
  
  <p>But for some reason it shows it like this <code>00:4:-12</code>. Maybe I have made a mistake. Really need some help with this. I know there are posts with practically same titles as mine but non had the answer I was looking for.</p>