TimeSpan::ToString Method (String)
Converts the value of the current TimeSpan object to its equivalent string representation by using the specified format.
Assembly: mscorlib (in mscorlib.dll)
The format parameter is not recognized or is not supported.
The format parameter can be any valid standard or custom format specifier for TimeSpan values. If format is equal to String::Empty or is nullptr, the return value of the current TimeSpan object is formatted with the common format specifier ("c"). If format is any other value, the method throws a FormatException.
If format is a standard format string, the format of the returned string is defined by the formatting conventions of the current culture.
The custom format strings for TimeSpan values do not include a date or time separator. If you want to include these elements in your format string, you must treat them as character literals. See the example for an illustration, and see the Custom TimeSpan Format Strings topic for more information.
The .NET Framework provides extensive formatting support, which is described in greater detail in the following formatting topics:
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.