![]() Parsing methods handle this missing information by using reasonable defaults: Text representing time often does only include hours, minutes, and an AM/PM designation. Similarly, "March 2018" represents the month of March in the year 2018. For example, most people would assume the date "March 12" represents the current year. The text representing a date or time might be missing some information. For the IFormatProvider parameter, specify a CultureInfo object, which represents a culture, or a DateTimeFormatInfo object. If you want a specific culture or custom settings, you specify the IFormatProvider parameter of a parsing method. The CultureInfo returned by CultureInfo.CurrentCulture has a CultureInfo.DateTimeFormat property that represents the current culture. Properties of a DateTimeFormatInfo describe the date and time separators, the names of months, days, and eras, and the format for the "AM" and "PM" designations. ![]() The current DateTimeFormatInfo object provides more control over how text should be interpreted as a date and time. For more information, see the articles on standard date and time format strings and custom date and time format strings. The ParseExact and TryParseExact methods convert a string representation that conforms to the pattern specified by a date and time format string. The Parse and TryParse methods convert many common representations of a date and time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |