Export (0) Print
Expand All

DateTimeStyles Enumeration

Defines the formatting options that customize string parsing for a number of DateTime and DateTimeOffset parsing methods.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
<FlagsAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration DateTimeStyles

Member nameDescription
Supported by Silverlight for Windows PhoneSupported by Xbox 360NoneDefault formatting options must be used. This value represents the default style for DateTime.Parse, DateTime.ParseExact, and DateTime.TryParse.
Supported by Silverlight for Windows PhoneSupported by Xbox 360AllowLeadingWhiteLeading white-space characters must be ignored during parsing, except if they occur in the DateTimeFormatInfo format patterns.
Supported by Silverlight for Windows PhoneSupported by Xbox 360AllowTrailingWhiteTrailing white-space characters must be ignored during parsing, except if they occur in the DateTimeFormatInfo format patterns.
Supported by Silverlight for Windows PhoneSupported by Xbox 360AllowInnerWhiteExtra white-space characters in the middle of the string must be ignored during parsing, except if they occur in the DateTimeFormatInfo format patterns.
Supported by Silverlight for Windows PhoneSupported by Xbox 360AllowWhiteSpacesExtra white-space characters anywhere in the string must be ignored during parsing, except if they occur in the DateTimeFormatInfo format patterns. This value is a combination of the AllowLeadingWhite, AllowTrailingWhite, and AllowInnerWhite values.
Supported by Silverlight for Windows PhoneSupported by Xbox 360NoCurrentDateDefaultIf the parsed string contains only the time and not the date, the parsing methods assume the Gregorian date with year = 1, month = 1, and day = 1. If this value is not used, the current date is assumed.
Supported by Silverlight for Windows PhoneSupported by Xbox 360AdjustToUniversalDate and time are returned as a Coordinated Universal Time (UTC). If the input string denotes a local time, through a time zone specifier or AssumeLocal, the date and time are converted from the local time to UTC. If the input string denotes a UTC time, through a time zone specifier or AssumeUniversal, no conversion occurs. If the input string does not denote a local or UTC time, no conversion occurs and the resulting Kind property is Unspecified.

Cannot be used with RoundtripKind.

Supported by Silverlight for Windows PhoneSupported by Xbox 360AssumeLocalIf 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.

Supported by Silverlight for Windows PhoneSupported by Xbox 360AssumeUniversalIf no time zone is specified in the parsed string, the string is assumed to denote a UTC.

Cannot be used with AssumeLocal or RoundtripKind.

Supported by Silverlight for Windows PhoneSupported by Xbox 360RoundtripKindFor parsing operations using DateTime methods on strings that contain time zone information, tries to prevent the conversion to a local DateTime value with its Kind property set to DateTimeKind.Local. For DateTimeOffset values, this flag has no effect.

The DateTimeStyles enumeration is used as a parameter that controls the parsing operation of the following methods:

The ParseExact and TryParseExact methods can use any of the DateTimeStyles values. However, if none of the Allow* values is selected, the input string must have exactly the same white-space characters as the format string.

If the input string does not contain any indication of the time zone, parsing methods assume that the date and time represents the local time and either set the DateTime.Kind property to DateTimeKind.Local or set the DateTimeOffset.Offset property to the time zone offset of the local system. To convert this date and time to Coordinated Universal Time (UTC), use the AdjustToUniversal value. The same effect can be achieved using ToUniversalTime. However, using the AdjustToUniversal value is more efficient.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft