DateTimeStyles Enumeration
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
Namespace: System.GlobalizationAssembly: mscorlib (in mscorlib.dll)
'Declaration <SerializableAttribute> _ <ComVisibleAttribute(True)> _ <FlagsAttribute> _ Public Enumeration DateTimeStyles 'Usage Dim instance As DateTimeStyles
/** @attribute SerializableAttribute() */ /** @attribute ComVisibleAttribute(true) */ /** @attribute FlagsAttribute() */ public enum DateTimeStyles
SerializableAttribute ComVisibleAttribute(true) FlagsAttribute public enum DateTimeStyles
| Member name | Description | |
|---|---|---|
![]() | AdjustToUniversal | Indicates that the date and time will be returned as a Coordinated Universal Time (UTC). If the input string denoted a Local time (through a time zone specifier or AssumeLocal) then the date and time is converted from the local time zone to UTC. If the input string denoted a UTC time (through a time zone specifier or AssumeUniversal) then no conversion occurs. If the input string did not denote a Local or UTC time (no time zone specifier, and neither AssumeLocal nor AssumeUniversal was included), then no conversion occurs and the Kind of the resulting DateTime is Unspecified. Cannot be used with RoundTripKind. |
![]() | AllowInnerWhite | Indicates that extra white-space characters in the middle of the string must be ignored during parsing, except if those white-space characters occur in the DateTimeFormatInfo format patterns. |
![]() | AllowLeadingWhite | Indicates that leading white-space characters must be ignored during parsing, except if those white-space characters occur in the DateTimeFormatInfo format patterns. |
![]() | AllowTrailingWhite | Indicates that trailing white-space characters must be ignored during parsing, except if those white-space characters occur in the DateTimeFormatInfo format patterns. |
![]() | AllowWhiteSpaces | Indicates that extra white-space characters anywhere in the string must be ignored during parsing, except if those white-space characters occur in the DateTimeFormatInfo format patterns. This value is a combination of the AllowLeadingWhite, AllowTrailingWhite, and AllowInnerWhite values. |
![]() | AssumeLocal | Indicates that if no time zone is specified in the parsed string, the string is assumed to denote a local time. Cannot be used with AssumeUniversal or RoundtripKind. |
![]() | AssumeUniversal | Indicates that if no time zone is specified in the parsed string, the string is assumed to denote a Coordinated Universal Time (UTC). Cannot be used with AssumeLocal or RoundtripKind. |
![]() | NoCurrentDateDefault | Indicates that, if the parsed string contains only the time and not the date, the DateTime.Parse and DateTime.ParseExact methods assume the Gregorian date with year = 1, month = 1, and day = 1. If this value is not used, the current date is assumed. |
![]() | None | Indicates that the default formatting options must be used. This is the default style for DateTime.Parse, DateTime.ParseExact, and DateTime.TryParse. |
![]() | RoundtripKind | Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. |
The ParseExact method can use any of DateTimeStyles values. However, if none of the Allow* values are selected, the input string must have exactly the same white-space characters as in the format string.
If the input string does not contain any indication of the time zone, DateTime.Parse and DateTime.ParseExact read the date and time based on the system's time zone setting. To convert the date and time to the Universal Time or Greenwich Mean Time (GMT), use the AdjustToUniversal value. The same effect can be achieved using DateTime.ToUniversalTime; however, using the AdjustToUniversal value with DateTime.Parse or DateTime.ParseExact is more efficient.
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
