asp.net.ph

DateTimeStyles Enumeration

System.Globalization Namespace


Defines the formatting options that customize how the DateTime.Parse and DateTime.ParseExact methods parse a string.

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

Members


Member name Description
AdjustToUniversal Indicates that the date and time must be converted to Universal Time or Greenwich mean time ( GMT ).
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.
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 and DateTime.ParseExact.

Remarks

The NoCurrentDateDefault value is the only value that is useful with the DateTime.Parse method, because DateTime.Parse always ignores leading, trailing, and inner white-space characters.

The DateTime.ParseExact can use any of DateTimeStyles values. 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 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.

See Also

DateTime.Parse   DateTime.ParseExact Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph