public class TimeSpanFormatProvider: IFormatProvider, ICustomFormatter
public object GetFormat(Type formatType)
public string Format(string? format, object? arg, IFormatProvider? formatProvider)
public static void Main()
Console.WriteLine("Hello World");
TimeSpan t = TimeSpan.FromMilliseconds(100101012);
string str = t.ToString("ms", new TimeSpanFormatProvider());
str = string.Format(new TimeSpanFormatProvider(), "{0:ms}", t);