asp.net.ph

DateTimeFormatInfo.DateSeparator Property

System.Globalization Namespace   DateTimeFormatInfo Class


Sets or retrieves the string that separates the components of a date; that is, the year, month, and day.

[ VB ]
public Property DateSeparator As String

[ C# ]
public string DateSeparator {get; set;}

[ C++ ]
public: __property String* get_DateSeparator ( );
public: __property void set_DateSeparator ( String* );

[ JScript ]
function get DateSeparator ( ) : String;
public function set DateSeparator ( String );

Property Value

The string that separates the components of a date; that is, the year, month, and day. The default for InvariantInfo is "/".

Exceptions


Exception Type Condition
ArgumentNullException The property is being set to a null reference ( Nothing in Visual Basic ).
InvalidOperationException The property is being set and the DateTimeFormatInfo is read-only.

Remarks

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

Example

This example shows how you can create a DateTimeFormatInfo object for a given culture, to gain access to the DateSeparator property for the specified culture.

First, you need to instantiate a CultureInfo object with the specified culture name, and then retrieve the CultureInfo.DateTimeFormat property.

This returns a DateTimeFormatInfo instance specific to the given culture, which you can then use to get to any DateTimeFormatInfo method or property, such as DateSeparator.

 Show me 

See Also

DateTimeFormatInfo Members   TimeSeparator Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph