System.DateTime.GetDateTimeFormats Method

Converts the value of this instance to all the string representations supported by the standard date and time format specifiers.


public string[] GetDateTimeFormats ()


A string array where each element is the representation of the value of this instance formatted with one of the standard date and time format specifiers.


The string array returned by the DateTime.GetDateTimeFormats method is equivalent to combining the string arrays returned by separate calls to the DateTime.GetDateTimeFormats(char) method with the "d", "D", "f", "F", "g", "G", "m", "o", "r", "s", "t", "T", "u", "U", and "y" standard format strings. For more information about standard format specifiers, see Standard Date and Time Format Strings.

Each element of the return value is formatted using information from the current culture. For more information about culture-specific formatting information for the current culture, see System.Globalization.CultureInfo.CurrentCulture.


Because this method uses culture-sensitive data, you should not assume that multiple calls to the method will return identical data. The data returned by this method can change if the current culture changes, the user overrides individual cultural settings, or an update occurs to the system's cultural data.


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