Export (0) Print
Expand All

DateTimeFormatInfo.GetInstance Method

Returns the DateTimeFormatInfo associated with the specified IFormatProvider.

[Visual Basic]
Public Shared Function GetInstance( _
   ByVal provider As IFormatProvider _
) As DateTimeFormatInfo
public static DateTimeFormatInfo GetInstance(
 IFormatProvider provider
public: static DateTimeFormatInfo* GetInstance(
 IFormatProvider* provider
public static function GetInstance(
   provider : IFormatProvider
) : DateTimeFormatInfo;


The IFormatProvider that gets the DateTimeFormatInfo.


A null reference (Nothing in Visual Basic) to get CurrentInfo.

Return Value

A DateTimeFormatInfo associated with the specified IFormatProvider.


This method uses the IFormatProvider.GetFormat method of formatProvider using DateTimeFormatInfo as the Type parameter. If formatProvider is a null reference (Nothing in Visual Basic) or if IFormatProvider.GetFormat returns a null reference (Nothing), this method returns CurrentInfo.

You can get a DateTimeFormatInfo for a specific culture using one of the following methods:

A DateTimeFormatInfo 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 CultureInfo class.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DateTimeFormatInfo Class | DateTimeFormatInfo Members | System.Globalization Namespace | IFormatProvider

© 2014 Microsoft