System.Globalization.DateTimeFormatInfo.GetInstance Method

Returns the System.Globalization.DateTimeFormatInfo object associated with the specified IFormatProvider.

Syntax

public static DateTimeFormatInfo GetInstance (IFormatProvider provider)

Parameters

provider
The IFormatProvider that gets the System.Globalization.DateTimeFormatInfo object.

Returns

A System.Globalization.DateTimeFormatInfo object associated with IFormatProvider.

Remarks

This method uses the IFormatProvider.GetFormat(Type) method of formatProvider using an System.Globalization.DateTimeFormatInfo object as the Type parameter. If formatProvider is null or if IFormatProvider.GetFormat(Type) returns null, this method returns DateTimeFormatInfo.CurrentInfo.

Your application can get a System.Globalization.DateTimeFormatInfo object for a specific culture using one of the following methods:

A System.Globalization.DateTimeFormatInfo object can be created only for the invariant culture or for specific cultures, not for neutral cultures.

For more information about the invariant culture, specific cultures, and neutral cultures, see the System.Globalization.CultureInfo class description.

Requirements

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0