format float to time c#

72

format float to time c# -

using System;

class Test
{
    static void Main()
    {
        float totalSeconds = 228.10803f;
        TimeSpan time = TimeSpan.FromSeconds(totalSeconds);
        Console.WriteLine(time.ToString("hh':'mm':'ss")); // 00:03:48
    }
}

Comments

Submit
0 Comments