Sometimes you have long processes and you even want display them up to the millisecond. Here is a way to do it.

1,002 Views
private static string ConvertToHMSmsString(long ms)
{
    TimeSpan t = TimeSpan.FromMilliseconds(ms);
    string answer = $"{t.Hours:D2}h:{t.Minutes:D2}m:{t.Seconds:D2}s:{t.Milliseconds:D3}ms";
    return answer;
}
About the Author

Have programmed in Modula-2 on a professional basis in the eighties. Now I am quite fond of C# AND Python!