DateTimeStyles DateTimeStyles DateTimeStyles DateTimeStyles Enum

Definition

Defines the formatting options that customize string parsing for some date and time parsing methods.

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

public enum class DateTimeStyles
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum DateTimeStyles
type DateTimeStyles = 
Public Enum DateTimeStyles
Inheritance
DateTimeStylesDateTimeStylesDateTimeStylesDateTimeStyles
Attributes

Fields

AdjustToUniversal AdjustToUniversal AdjustToUniversal AdjustToUniversal 16

Date 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. This value cannot be used with RoundtripKind.

AllowInnerWhite AllowInnerWhite AllowInnerWhite AllowInnerWhite 4

Extra white-space characters in the middle of the string must be ignored during parsing, except if they occur in the DateTimeFormatInfo format patterns.

AllowLeadingWhite AllowLeadingWhite AllowLeadingWhite AllowLeadingWhite 1

Leading white-space characters must be ignored during parsing, except if they occur in the DateTimeFormatInfo format patterns.

AllowTrailingWhite AllowTrailingWhite AllowTrailingWhite AllowTrailingWhite 2

Trailing white-space characters must be ignored during parsing, except if they occur in the DateTimeFormatInfo format patterns.

AllowWhiteSpaces AllowWhiteSpaces AllowWhiteSpaces AllowWhiteSpaces 7

Extra 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.

AssumeLocal AssumeLocal AssumeLocal AssumeLocal 32

If no time zone is specified in the parsed string, the string is assumed to denote a local time. This value cannot be used with AssumeUniversal or RoundtripKind.

AssumeUniversal AssumeUniversal AssumeUniversal AssumeUniversal 64

If no time zone is specified in the parsed string, the string is assumed to denote a UTC. This value cannot be used with AssumeLocal or RoundtripKind.

NoCurrentDateDefault NoCurrentDateDefault NoCurrentDateDefault NoCurrentDateDefault 8

If 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.

None None None None 0

Default formatting options must be used. This value represents the default style for the Parse(String), ParseExact(String, String, IFormatProvider), and TryParse(String, DateTime) methods.

RoundtripKind RoundtripKind RoundtripKind RoundtripKind 128

The DateTimeKind field of a date is preserved when a DateTime object is converted to a string using the "o" or "r" standard format specifier, and the string is then converted back to a DateTime object.

Remarks

DateTimeStyles values can be used with any of the following date and time parsing methods that include a styles parameter to define the interpretation of the style elements that may be present in the string to be parsed:

Applies to

See also