Export (0) Print
Expand All

DateTimeFormatInfo.TimeSeparator Property

Gets or sets the string that separates the components of time, that is, the hour, minutes, and seconds.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

public string TimeSeparator { get; set; }

Property Value

Type: System.String
The string that separates the components of time. The default for InvariantInfo is ":".

ExceptionCondition
ArgumentNullException

The property is being set to null.

InvalidOperationException

The property is being set and the DateTimeFormatInfo object is read-only.

If the custom pattern includes the format pattern ":", DateTime.ToString displays the value of TimeSeparator in place of the ":" in the format pattern.

The time separator is derived from the ShortTimePattern property. Your applications are recommended to set the short or long time patterns to the exact values of interest, instead of attempting to have the time separator replaced. For example, to obtain the pattern h-mm-ss, the application should set "h-mm-ss" specifically. This also permits the setting of patterns such as "h'h 'mm'm 'ss's'" (3h 36m 12s) that don't contain a traditional separator between all parts of the format.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2015 Microsoft