Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Globalization.​DateTimeFormatInfo

Assembly: System.Runtime

Inheritance: object → DateTimeFormatInfo

Implemented Interfaces

Provides culture-specific information about the format of date and time values.

Properties

public string[]
AbbreviatedDayNames
Gets or sets a one-dimensional array of type <see cref="T:System.String" /> containing the culture-specific abbreviated names of the days of the week.
public string[]
AbbreviatedMonthGenitiveNames
Gets or sets a string array of abbreviated month names associated with the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> object.
public string[]
AbbreviatedMonthNames
Gets or sets a one-dimensional string array that contains the culture-specific abbreviated names of the months.
public string
AMDesignator
Gets or sets the string designator for hours that are "ante meridiem" (before noon).
public Calendar
Calendar
Gets or sets the calendar to use for the current culture.
CalendarWeekRule
Gets or sets a value that specifies which rule is used to determine the first calendar week of the year.
public static DateTimeFormatInfo
CurrentInfo
Gets a read-only <see cref="T:System.Globalization.DateTimeFormatInfo" /> object that formats values based on the current culture.
public string
DateSeparator
Gets or sets the string that separates the components of a date, that is, the year, month, and day.
public string[]
DayNames
Gets or sets a one-dimensional string array that contains the culture-specific full names of the days of the week.
public DayOfWeek
FirstDayOfWeek
Gets or sets the first day of the week.
public string
FullDateTimePattern
Gets or sets the custom format string for a long date and long time value.
public static DateTimeFormatInfo
InvariantInfo
Gets the default read-only <see cref="T:System.Globalization.DateTimeFormatInfo" /> object that is culture-independent (invariant).
public bool
IsReadOnly
Gets a value indicating whether the <see cref="T:System.Globalization.DateTimeFormatInfo" /> object is read-only.
public string
LongDatePattern
Gets or sets the custom format string for a long date value.
public string
LongTimePattern
Gets or sets the custom format string for a long time value.
public string
MonthDayPattern
Gets or sets the custom format string for a month and day value.
public string[]
MonthGenitiveNames
Gets or sets a string array of month names associated with the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> object.
public string[]
MonthNames
Gets or sets a one-dimensional array of type <see cref="T:System.String" /> containing the culture-specific full names of the months.
public string
NativeCalendarName
Gets the native name of the calendar associated with the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> object.
public string
PMDesignator
Gets or sets the string designator for hours that are "post meridiem" (after noon).
public string
RFC1123Pattern
Gets the custom format string for a time value that is based on the Internet Engineering Task Force (IETF) Request for Comments (RFC) 1123 specification.
public string
ShortDatePattern
Gets or sets the custom format string for a short date value.
public string[]
ShortestDayNames
Gets or sets a string array of the shortest abbreviated day names associated with the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> object.
public string
ShortTimePattern
Gets or sets the custom format string for a short time value.
public string
SortableDateTimePattern
Gets the custom format string for a sortable date and time value.
public string
TimeSeparator
Gets or sets the string that separates the components of time, that is, the hour, minutes, and seconds.
public string
UniversalSortableDateTimePattern
Gets the custom format string for a universal, sortable date and time string, as defined by ISO 8601.
public string
YearMonthPattern
Gets or sets the custom format string for a year and month value.

Methods

public object
Clone​()
Creates a shallow copy of the <see cref="T:System.Globalization.DateTimeFormatInfo" /> .
Returns A new <see cref="T:System.Globalization.DateTimeFormatInfo" /> object copied from the original <see cref="T:System.Globalization.DateTimeFormatInfo" /> .
public string
GetAbbreviatedDayName​(DayOfWeek dayofweek)
Returns the culture-specific abbreviated name of the specified day of the week based on the culture associated with the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> object.
Returns The culture-specific abbreviated name of the day of the week represented by <paramref name="dayofweek" /> .
dayofweek A <see cref="T:System.DayOfWeek" /> value.
public string
GetAbbreviatedEraName​(int era)
Returns the string containing the abbreviated name of the specified era, if an abbreviation exists.
Returns A string containing the abbreviated name of the specified era, if an abbreviation exists. -or- A string containing the full name of the era, if an abbreviation does not exist.
era The integer representing the era.
public string
GetAbbreviatedMonthName​(int month)
Returns the culture-specific abbreviated name of the specified month based on the culture associated with the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> object.
Returns The culture-specific abbreviated name of the month represented by <paramref name="month" /> .
month An integer from 1 through 13 representing the name of the month to retrieve.
public string[]
GetAllDateTimePatterns​()
Returns all the standard patterns in which date and time values can be formatted.
Returns An array that contains the standard patterns in which date and time values can be formatted.
public string[]
GetAllDateTimePatterns​(char format)
Returns all the patterns in which date and time values can be formatted using the specified standard format string.
Returns An array containing the standard patterns in which date and time values can be formatted using the specified format string.
format A standard format string.
public string
GetDayName​(DayOfWeek dayofweek)
Returns the culture-specific full name of the specified day of the week based on the culture associated with the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> object.
Returns The culture-specific full name of the day of the week represented by <paramref name="dayofweek" /> .
dayofweek A <see cref="T:System.DayOfWeek" /> value.
public int
GetEra​(string eraName)
Returns the integer representing the specified era.
Returns The integer representing the era, if <paramref name="eraName" /> is valid; otherwise, -1.
eraName The string containing the name of the era.
public string
GetEraName​(int era)
Returns the string containing the name of the specified era.
Returns A string containing the name of the era.
era The integer representing the era.
public object
GetFormat​(Type formatType)
Returns an object of the specified type that provides a date and time formatting service.
Returns The current object, if <paramref name="formatType" /> is the same as the type of the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> ; otherwise, <see langword="null" /> .
formatType The type of the required formatting service.
public static DateTimeFormatInfo
GetInstance​(IFormatProvider? provider)
Returns the <see cref="T:System.Globalization.DateTimeFormatInfo" /> object associated with the specified <see cref="T:System.IFormatProvider" /> .
Returns A <see cref="T:System.Globalization.DateTimeFormatInfo" /> object associated with <see cref="T:System.IFormatProvider" /> .
provider The <see cref="T:System.IFormatProvider" /> that gets the <see cref="T:System.Globalization.DateTimeFormatInfo" /> object. -or- <see langword="null" /> to get <see cref="P:System.Globalization.DateTimeFormatInfo.CurrentInfo" /> .
public string
GetMonthName​(int month)
Returns the culture-specific full name of the specified month based on the culture associated with the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> object.
Returns The culture-specific full name of the month represented by <paramref name="month" /> .
month An integer from 1 through 13 representing the name of the month to retrieve.
public string
GetShortestDayName​(DayOfWeek dayOfWeek)
Obtains the shortest abbreviated day name for a specified day of the week associated with the current <see cref="T:System.Globalization.DateTimeFormatInfo" /> object.
Returns The abbreviated name of the week that corresponds to the <paramref name="dayOfWeek" /> parameter.
dayOfWeek One of the <see cref="T:System.DayOfWeek" /> values.
public static DateTimeFormatInfo
ReadOnly​(DateTimeFormatInfo dtfi)
Returns a read-only <see cref="T:System.Globalization.DateTimeFormatInfo" /> wrapper.
Returns A read-only <see cref="T:System.Globalization.DateTimeFormatInfo" /> wrapper.
dtfi The <see cref="T:System.Globalization.DateTimeFormatInfo" /> object to wrap.
public void
SetAllDateTimePatterns​(string[] patterns, char format)
Sets the custom date and time format strings that correspond to a specified standard format string.
patterns An array of custom format strings.
format The standard format string associated with the custom format strings specified in the <paramref name="patterns" /> parameter.
public bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj The object to compare with the current object.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.