BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 This type is safe for multithreaded operations. System.Object System.ICloneable System.IFormatProvider System.Runtime.InteropServices.ComVisible(true)

The properties of the class contain culture-specific information for formatting or parsing date and time values such as the following:

The patterns used to format date values.

The patterns used to format time values.

The names of the days of the week.

The names of the months of the year.

The A.M. and P.M. designators used in time values.

The calendar in which dates are expressed.

In this section:

Instantiating a DateTimeFormatInfo object

For the Invariant Culture

For a Specific Culture

For a neutral culture

For the current culture

DateTimeFormatInfo and dynamic data

Formatting dates and times

Format strings and DateTimeFormatInfo properties

Modifying DateTimeFormatInfo properties

## Instantiating a DateTimeFormatInfo object

A object can represent the formatting conventions of the invariant culture, a specific culture, a neutral culture, or the current culture. This section discusses how to instantiate each type of object.

## Instantiating a DateTimeFormatInfo object for the invariant culture

The invariant culture represents a culture that is culture-insensitive. It is based on the English language, but not on any specific English-speaking country/region. Although the data of specific cultures can be dynamic and can change to reflect new cultural conventions or user preferences, the data of the invariant culture does not change. You can instantiate a object that represents the formatting conventions of the invariant culture in the following ways:

By retrieving the value of the property. The returned object is read-only.

By calling the parameterless constructor. The returned object is read/write.

By retrieving the value of the property from the object that is returned by the property. The returned object is read-only.

The following example uses each of these methods to instantiate a object that represents the invariant culture. It then indicates whether the object is read-only.

code reference: System.Globalization.DateTimeFormatInfo.Class#1

## Instantiating a DateTimeFormatInfo object for a specific culture

A specific culture represents a language that is spoken in a particular country/region. For example, en-US is a specific culture that represents the English language spoken in the United States, and en-CA is a specific culture that represents the English language spoken in Canada. You can instantiate a object that represents the formatting conventions of a specific culture in the following ways:

By calling the method and retrieving the value of the returned object's property. The returned object is read-only.

By passing the static method a object that represents the culture whose object you want to retrieve. The returned object is read/write.

By calling the static method and retrieving the value of the returned object's property. The returned object is read/write.

By calling the class constructor and retrieving the value of the returned object's property. The returned object is read/write.

The following example illustrates each of these ways to instantiate a object and indicates whether the resulting object is read-only.

code reference: System.Globalization.DateTimeFormatInfo.Class#3

## Instantiating a DateTimeFormatInfo object for a neutral culture

A neutral culture represents a culture or language that is independent of a country/region; it is typically the parent of one or more specific cultures. For example, Fr is a neutral culture for the French language and the parent of the fr-FR culture. You can instantiate a object that represents the formatting conventions of a neutral culture in the same ways that you create a object that represents the formatting conventions of a specific culture. In addition, you can retrieve a neutral culture's object by retrieving a neutral culture from a specific culture's property and retrieving the object returned by its property. Unless the parent culture represents the invariant culture, the returned object is read/write. The following example illustrates these ways of instantiating a object that represents a neutral culture.

code reference: System.Globalization.DateTimeFormatInfo.Class#2

In the .NET Framework versions 1.0 through net_v35_short, trying to retrieve a object that reflects the formatting conventions of a neutral culture throws a exception.

However, a neutral culture lacks culture-specific formatting information, because it is independent of a specific country/region. Instead of populating the object with generic values, the .NET Framework returns a object that reflects the formatting conventions of a specific culture that is a child of the neutral culture. For example, the object for the neutral en culture reflects the formatting conventions of the en-US culture, and the object for the fr culture reflects the formatting conventions of the fr-FR culture.

You can use code like the following to determine which specific culture's formatting conventions a neutral culture represents. The example uses reflection to compare the properties of a neutral culture with the properties of a specific child culture. It considers two calendars to be equivalent if they are the same calendar type and, for Gregorian calendars, if their properties have identical values.

code reference: System.Globalization.DateTimeFormatInfo.Class#6

## Instantiating a DateTimeFormatInfo object for the current culture

You can instantiate a object that represents the formatting conventions of the current culture in the following ways:

By retrieving the value of the property. The returned object is read-only.

By retrieving the value of the property from the object that is returned by the property. The returned object is read-only.

By calling the method with a object that represents the current culture. The returned object is read-only.

The following example uses each of these methods to instantiate a object that represents the formatting conventions of the current culture. It then indicates whether the object is read-only.

code reference: System.Globalization.DateTimeFormatInfo.Class#4

You can create a writable object that represents the conventions of the current thread culture in one of these ways:

By retrieving a object in any of the three previous ways and calling the method on the returned object. This creates a copy of the original object, except that its property is false.

By calling the method to create a object that represents the current culture, and then using its property to retrieve the object.

The following example illustrates each way of instantiating a read/write object and displays the value of its property.

code reference: System.Globalization.DateTimeFormatInfo.Class#7

In Windows, the user can override some of the property values used in formatting and parsing operations through the Region and Language application in Control Panel. For example, a user whose culture is English (United States) might choose to display long time values using a 24-hour clock (in the format HH:mm:ss) instead of the default 12-hour clock (in the format h:mm:ss tt). The objects retrieved in the ways discussed previously all reflect these user overrides. If this is undesirable, you can create a object that does not reflect user overrides (and is also read/write instead of read-only) by calling the constructor and supplying a value of false for the argument. The following example illustrates this for a system whose current culture is English (United States) and whose long time pattern has been changed from the default of h:mm:ss tt to HH:mm:ss.

code reference: System.Globalization.DateTimeFormatInfo.Class#8

## DateTimeFormatInfo and dynamic data

The culture-specific data for formatting date and time values provided by the class is dynamic, just like cultural data provided by the class. You should not make any assumptions about the stability of values for objects that are associated with particular objects. Only the data provided by the invariant culture and its associated object is stable. Other data can change between application sessions or even while your application is running. There are four major sources of change:

System updates. Cultural preferences such as the preferred calendar or customary date and time formats change over time. When this happens, Windows Update includes changes to the property value for a particular culture.

Replacement cultures. The class can be used to replace the data of an existing culture.

Cascading changes to property values. A number of culture-related properties can change at run time, which, in turn, causes data to change. For example, the current culture can be changed either programmatically or through user action. When this happens, the object returned by the property changes to an object associated with the current culture. Similarly, a culture's calendar can change, which can result in changes to numerous property values.

User preferences. Users of your application might choose to override some of the values associated with the current system culture through the regional and language options in Control Panel. For example, users might choose to display the date in a different format. If the property is set to true, the properties of the object is also retrieved from the user settings. If the user settings are incompatible with the culture associated with the object (for example, if the selected calendar is not one of the calendars indicated by the property), the results of the methods and the values of the properties are undefined.

To minimize the possibility of inconsistent data, all user-overridable properties of a object are initialized when the object is created. There is still a possibility of inconsistency, because neither object creation nor the user override process is atomic and the relevant values can change during object creation. However, this situation should be extremely rare.

You can control whether user overrides are reflected in objects that represent the same culture as the system culture. The following table lists the ways in which a object can be retrieved and indicates whether the resulting object reflects user overrides.

Source of CultureInfo and DateTimeFormatInfo object

Reflects user overrides

CultureInfo.CurrentCulture.DateTimeFormat property

Yes

property

Yes

method

Yes

method

No

constructor

Yes

constructor

Depends on value of parameter

Unless there is a compelling reason to do otherwise, you should respect user overrides when you use the object in client applications to format and parse user input or to display data. For server applications or unattended applications, you should not. However, if you are using the object either explicitly or implicitly to persist date and time data in string form, you should either use a object that reflects the formatting conventions of the invariant culture, or you should specify a custom date and time format string that you use regardless of culture.

## Formatting dates and times

A object is used implicitly or explicitly in all date and time formatting operations. These include calls to the following methods:

All date and time formatting methods, such as and .

The major composite formatting method, which is .

Other composite formatting methods, such as and .

All date and time formatting operations make use of an implementation. The interface includes a single method, . This callback method is passed a object that represents the type needed to provide formatting information. The method returns either an instance of that type or null if it cannot provide an instance of the type. The .NET Framework includes two implementations for formatting dates and times:

The class, which represents a specific culture (or a specific language in a specific country/region). In a date and time formatting operation, the method returns the object associated with its property.

The class, which provides information about the formatting conventions of its associated culture. The method returns an instance of itself.

If an implementation is not provided to a formatting method explicitly, the object returned by the property that represents the current thread culture is used.

The following example illustrates the relationship between the interface and the class in formatting operations. It defines a custom implementation whose method displays the type of the object requested by the formatting operation. If it is requesting a object, the method provides the object for the current thread culture. As the output from the example shows, the method requests a object to provide formatting information, whereas the method requests and objects as well as an implementation.

code reference: System.Globalization.DateTimeFormatInfo.Class#9

## Format strings and DateTimeFormatInfo properties

The object includes three kinds of properties that are used in formatting operations with date and time values:

Calendar-related properties. Properties such as , , , and , are associated with the calendar used by the culture, which is defined by the property. These properties are used for long date and time formats.

Properties that produce a standards-defined result string. The , , and properties contain custom format strings that produce result strings defined by international standards. These properties are read-only and cannot be modified.

Properties that define culture-sensitive result strings. Some properties, such as and , contain custom format strings that specify the format of the result string. Others, such as , , , and , define culture-sensitive symbols or substrings that can be included in a result string.

The standard date and time format strings, such as "d", "D", "f", and "F", are aliases that correspond to particular format pattern properties. Most of the custom date and time format specifiers are related to strings or substrings that a formatting operation inserts into the result stream. The following table lists the standard and custom date and time format specifiers and their associated properties. For details about how to use these format specifiers, see Standard Date and Time Format Strings and Custom Date and Time Format Strings. Note that each standard format string corresponds to a property whose value is a custom date and time format string. The individual specifiers in this custom format string in turn correspond to other properties. The table lists only the properties for which the standard format strings are aliases, and does not list properties that may be accessed by custom format strings assigned to those aliased properties. In addition, the table lists only custom format specifiers that correspond to properties.

Format specifier

Associated properties

"d" (short date; standard format string)

, to define the overall format of the result string.

"D" (long date; standard format string)

, to define the overall format of the result string.

"f" (full date / short time; standard format string)

, to define the format of the date component of the result string.

, to define the format of the time component of the result string.

"F" (full date / long time; standard format string)

, to define the format of the date component of the result string.

, to define the format of the time component of the result string.

"g" (general date / short time; standard format string)

, to define the format of the date component of the result string.

, to define the format of the time component of the result string.

"G" (general date / long time; standard format string)

, to define the format of the date component of the result string.

, to define the format of the time component of the result string.

"M", "m" (month/day; standard format string)

, to define the overall format of the result string.

"O", "o" (round-trip date/time; standard format string)

None.

"R", "r" (RFC1123; standard format string)

, to define a result string that conforms to the RFC 1123 standard. The property is read-only.

"s" (sortable date/time; standard format string)

, to define a result string that conforms to the ISO 8601 standard. The property is read-only.

"t" (short time; standard format string)

, to define the overall format of the result string.

"T" (long time; standard format string)

, to define the overall format of the result string.

"u" (universal sortable date/time; standard format string)

, to define a result string that conforms to the ISO 8601 standard for coordinated universal time. The property is read-only.

"U" (universal full date/time; standard format string)

, to define the overall format of the result string.

"Y", "y" (year month; standard format string)

, to define the overall format of the result string.

"ddd" (custom format specifier)

, to include the abbreviated name of the day of the week in the result string.

"g", "gg" (custom format specifier)

Calls the method to insert the era name in the result string.

"MMM" (custom format specifier)

, to include the abbreviated month name in the result string.

"MMMM" (custom format specifier)

or , to include the full month name in the result string.

"t" (custom format specifier)

or , to include the first character of the AM/PM designator in the result string.

"tt" (custom format specifier)

or , to include the full AM/PM designator in the result string.

":" (custom format specifier)

, to include the time separator in the result string.

"/" (custom format specifier)

, to include the date separator in the result string.

## Modifying DateTimeFormatInfo properties

You can change the result string produced by date and time format strings by modifying the associated properties of a writable object. To determine if a object is writable, use the property. To customize a object in this way:

Create a read/write copy of a object whose formatting conventions you want to modify. (See the Instantiating a DateTimeFormatInfo object section.)

Modify the property or properties that are used to produce the desired result string. (For information about how formatting methods use properties to define result strings, see the previous section, Format strings and DateTimeFormatInfo properties.)

Use the custom object you created as the argument in calls to formatting methods.

There are two other ways to change the fomat of a result string:

You can use the class to define either a custom culture (a culture that has a unique name and that supplements existing cultures) or a replacement culture (one that is used instead of a specific culture). You can save and access this culture programmatically as you would any object supported by the .NET Framework.

If the result string is not culture-sensitive and doesn't follow a predefined format, you can use a custom date and time format string. For example, if you are serializing date and time data in the format YYYYMMDDHHmmss, you can generate the result string by passing the custom format string to the method, and you can convert the result string back to a value by calling the method.

## Changing the short date pattern

The following example changes the format of a result string produced by the "d" (short date) standard format string. It changes the associated property for the en-US or English (United States) culture from its default of "M/d/yyyy" to "yyyy'-"MM"-"dd" and uses the "d" standard format string to display the date both before and after the property is changed.

code reference: System.Globalization.DateTimeFormatInfo.Class#10

## Changing the date separator character

The following example changes the date separator character in a object that represents the formatting conventions of the fr-FR culture. The example uses the "g" standard format string to display the date both before and after the property is changed.

code reference: System.Globalization.DateTimeFormatInfo.Class#12

## Changing day name abbreviations and the long date pattern

In some cases, the long date pattern, which typically displays the full day and month name along with the number of the day of the month and the year, may be too long. The following example shortens the long date pattern for the en-US culture to return a one-character or two-character day name abbreviation followed by the day number, the month name abbreviation, and the year. It does this by assigning shorter day name abbreviations to the array, and by modifying the custom format string assigned to the property. This affects the result strings returned by the "D" and "f" standard format strings.

code reference: System.Globalization.DateTimeFormatInfo.Class#13

Ordinarily, the change to the property also affects the property, which in turn defines the result string returned by the "F" standard format string. To preserve the original full date and time pattern, the example reassigns the original custom format string assigned to the property after the property is modified.

## Changing from a 12-hour clock to a 24-hour clock

For many cultures in the .NET Framework, the time is expressed by using a 12-hour clock and an AM/PM designator. The following example defines a ReplaceWith24HourClock method that replaces any time format that uses a 12-hour clock with a format that uses a 24-hour clock.

code reference: System.Globalization.DateTimeFormatInfo.Class#14

The example uses a regular expression to modify the format string. The regular expression pattern @"^(?<openAMPM>\s*t+\s*)? (?(openAMPM) h+(?<nonHours>[^ht]+)$ | \s*h+(?<nonHours>[^ht]+)\s*t+) is defined as follows:

Pattern

Description

^

Begin the match at the beginning of the string.

(?<openAMPM>\s*t+\s*)?

Match zero or one occurrence of zero or more white-space characters, followed by the letter "t" one or more times, followed by zero or more white-space characters. This capturing group is named openAMPM.

(?(openAMPM) h+(?<nonHours>[^ht]+)$

If the openAMPM group has a match, match the letter "h" one or more times, followed by one or more characters that are neither "h" nor "t". The match ends at the end of the string. All characters captured after "h" are included in a capturing group named nonHours.

| \s*h+(?<nonHours>[^ht]+)\s*t+)

If the openAMPM group does not have a match, match the letter "h" one or more times, followed by one or more characters that are neither "h" nor "t", followed by zero or more white-space characters. Finally, match one or more occurrences of the letter "t". All characters captured after "h" and before the white-spaces and "t" are included in a capturing group named nonHours.

The nonHours capturing group contains the minute and possibly the second component of a custom date and time format string, along with any time separator symbols. The replacement pattern HH${nonHours} prepends the substring "HH" to these elements.

## Displaying and changing the era in a date

The following example adds the "g" custom format specifier to the property of an object that represents the formatting conventions of the en-US culture. This addition affects the following three standard format strings:

The "D" (long date) standard format string, which maps directly to the property.

The "f" (full date / short time) standard format string, which produces a result string that concatenates the substrings produced by the and properties.

The "F" (full date / long time) standard format string, which maps directly to the property. Because we have not explicitly set this property value, it is generated dynamically by concatenating the and properties.

The example also shows how to change the era name for a culture whose calendar has a single era. In this case, the en-US culture uses the Gregorian calendar, which is represented by a object. The class supports a single era, which it names A.D. (Anno Domini). The example changes the era name to C.E. (Common Era) by replacing the "g" custom format specifier in the format string assigned to the property with a literal string. The use of a literal string is necessary, because the era name is typically returned by the method from private data in the culture tables supplied by either the .NET Framework or the Windows operating system.

code reference: System.Globalization.DateTimeFormatInfo.Class#11

## Parsing date and time strings

Parsing involves converting the string representation of a date and time to a or value. Both of these types include the Parse, TryParse, ParseExact, and TryParseExact methods to support parsing operations. The Parse and TryParse methods convert a string that can have a variety of formats, whereas ParseExact and TryParseExact require that the string have a defined format or formats. If the parsing operation fails, Parse and ParseExact throw an exception, whereas TryParse and TryParseExact return false.

The parsing methods implicitly or explicitly use a enumeration value to determine which style elements (such as leading, trailing, or inner white space) can be present in the string to be parsed, and how to interpret the parsed string or any missing elements. If you don't provide a value when you call the Parse or TryParse method, the default is , which is a composite style that includes the , , and flags. For the ParseExact and TryParseExact methods, the default is ; the input string must correspond precisely to a particular custom date and time format string.

The parsing methods also implicitly or explicitly use a object that defines the specific symbols and patterns that can occur in the string to be parsed. If you don't provide a object, the object for the current thread culture is used by default. For more information about parsing date and time strings, see the individual parsing methods, such as , , , and .

The following example illustrates the culture-sensitive nature of parsing date and time strings. It tries to parse two date strings by using the conventions of the en-US, en-GB, fr-FR, and fi-FI cultures. The date that is interpreted as 8/18/2014 in the en-US culture throws a exception in the other three cultures because 18 is interpreted as the month number. 1/2/2015 is parsed as the second day of the first month in the en-US culture, but as the first day of the second month in the remaining cultures.

code reference: System.Globalization.DateTimeFormatInfo.Class#15

Date and time strings are typically parsed for two reasons:

To convert user input into a date and time value.

To round-trip a date and time value; that is, to deserialize a date and time value that was previously serialized as a string.

The following sections discuss these two operations in greater detail.

## Parsing user strings

When you parse date and time strings input by the user, you should always instantiate a object that reflects the user's cultural settings, including any customizations the user may have made. Otherwise, the date and time object may have incorrect values. For information about how to instantiate a object that reflects user cultural customizations, see the DateTimeFormatInfo and dynamic data section.

The following example illustrates the difference between a parsing operation that reflects user cultural settings and one that does not. In this case, the default system culture is en-US, but the user has used Control Panel, Region and Language to change the short date pattern from its default of "M/d/yyyy" to "yy/MM/dd". When the user enters a string that reflects user settings, and the string is parsed by a object that also reflects user settings (overrides), the parsing operation returns a correct result. However, when the string is parsed by a object that reflects standard en-US cultural settings, the parsing method throws a exception because it interprets 14 as the number of the month, not the last two digits of the year.

code reference: System.Globalization.DateTimeFormatInfo.Class#16

## Serializing and deserializing date and time data

Serialized date and time data are expected to round-trip; that is, all serialized and deserialized values should be identical. If a date and time value represents a single moment in time, the deserialized value should represent the same moment in time regardless of the culture or time zone of the system on which it was restored. To round-trip date and time data successfully, you must use the conventions of the invariant culture, which is returned by the property, to generate and parse the data. The formatting and parsing operations should never reflect the conventions of the default culture. If you use default cultural settings, the portability of the data is strictly limited; it can be successfully deserialized only on a thread whose cultural-specific settings are identical to those of the thread on which it was serialized. In some cases, this means that the data cannot even be successfully serialized and deserialized on the same system.

If the time component of a date and time value is significant, it should also be converted to UTC and serialized by using the "o" or "r" standard format string. The time data can then be restored by calling a parsing method and passing it the appropriate format string along with the invariant culture as the argument.

The following example illustrates the process of round-tripping a date and time value. It serializes a date and time on a system that observes U.S. Pacific time and whose current culture is en-US.

code reference: System.Globalization.DateTimeFormatInfo.Class#17

It deserializes the data on a system in the Brussels, Copenhagen, Madrid and Paris time zone and whose current culture is fr-FR. The restored date is nine hours later than the original date, which reflects the time zone adjustment from eight hours behind UTC to one hour ahead of UTC. Both the original date and the restored date represent the same moment in time.

code reference: System.Globalization.DateTimeFormatInfo.Class#18

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

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor creates a object that represents the date and time information of the invariant culture. To create a object for a specific culture, create a object for that culture and retrieve the object returned by its property.

  The properties of the object created by this constructor can be modified. However, you cannot modify the property, because the invariant culture supports only a localized version of the Gregorian calendar. To create a object that uses a specific calendar, you must instantiate a object that supports that calendar and assign the calendar to the property of the object returned by the property.

  Initializes a new writable instance of the class that is culture-independent (invariant).

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String[]

  A one-dimensional array of type containing the culture-specific abbreviated names of the days of the week.

  The value specified for a set operation is a null reference. The value specified for a set operation is not an array with exactly 7 elements. The current instance is read-only and a set operation was attempted.

  If setting this property, the array must be one-dimensional and must have exactly seven elements.

  If a custom format string includes the "ddd" format specifier, the or method includes the appropriate member of the array in place of the "ddd" in the result string.

  This property is affected if the value of the property changes. If the selected does not support abbreviated day names, the array contains the full day names.

  Gets or sets a one-dimensional array of type containing the culture-specific abbreviated names of the days of the week.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.String[] To be added.

  In some languages, a month name that is part of a date appears in the genitive case. For example, a date in the ru-RU or Russian (Russia) culture consists of the day number and the genitive month name, such as 1 Января (1 January). For these cultures, if a custom format string includes the "MMM" format specifier, the or method includes the appropriate member of the array in place of the "MMM" in the result string.

  In a set operation, the array must be one-dimensional with exactly 13 elements, because objects accommodate calendars that have 13 months. For calendars that have 12 months, the thirteenth element should be .

  If you set the property, you must also set the property.

  Gets or sets a string array of abbreviated month names associated with the current object.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String[]

  A one-dimensional array of type containing the abbreviated names of the months. For cultures with 12-month calendars the 13th element of the array is an empty string.

  The value specified for a set operation is a null reference. The value specified for a set operation is not an array with exactly 13 elements. The current instance is read-only and a set operation was attempted.

  If you set this property, the array must be one-dimensional with exactly 13 elements. objects accommodate calendars with 13 months.

  If you set the property, you must also set the property. The and properties are used to format dates using the following format strings:

  A standard date and time format string that aliases a custom format string that includes the "MMM" format specifier.

  A custom date and time format string that includes the "MMM" format specifier.

  This property is affected if the value of the property changes. If the selected does not support abbreviated month names, the array contains the full month names.

  Gets or sets a one-dimensional string array that contains the culture-specific abbreviated names of the months.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  The designator for hours that are before noon.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property is used for all times from 0:00:00 (midnight) to 11:59:59.999.

  If a custom format string includes the "tt" format specifier and the time is before noon, the or method includes the value of the property in place of "tt" in the result string. If the custom format string includes the "t" custom format specifier, only the first character of the property value is included. You should use "tt" for languages for which it is necessary to maintain the distinction between A.M. and P.M. An example is Japanese, in which the A.M. and P.M. designators differ in the second character instead of the first character.

  For cultures that do not use an A.M. designator, this property returns an empty string.

  Gets or sets the string designator for hours that are "ante meridiem" (before noon).

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.Calendar To be added.

  The property accepts only calendars that are valid for the culture that is associated with the object. The property specifies the calendars that can be used by a particular culture, and the property specifies the default calendar for the culture.

  Changing the value of this property affects the following properties as well: , , , , , , , , , , and .

  For example, if the culture of the current thread is Japanese, this property accepts , , or . When the is used, the default long date specifier is "gg y'\x5e74'M'\x6708'd'\x65e5'". When the , is used, the default long date specifier is "yyyy'\x5e74'M'\x6708'd'\x65e5'".

  Gets or sets the calendar to use for the current culture.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.CalendarWeekRule To be added.

  This property is affected if the value of the property changes.

  Gets or sets a value that specifies which rule is used to determine the first calendar week of the year.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object

  The clone is writable even if the original object is read-only. Therefore, the properties of the clone can be modified with user-defined patterns.

  A shallow copy of an object is a copy of the object only. If the object contains references to other objects, the shallow copy does not create copies of the referred objects. It refers to the original objects instead. In contrast, a deep copy of an object creates a copy of the object and a copy of everything directly or indirectly referenced by that object.

  Creates a shallow copy of the .

  A new object copied from the original .

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.DateTimeFormatInfo

  A read-only instance based on the culture of the current thread.

  The object returned by the property reflects user overrides.

  Gets a read-only object that formats values based on the current culture.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  The to use to separate the year, month and day components of a date.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  If a custom format string includes the "/" format specifier, the method displays the value of in place of the "/" in the result string.

  The property defines the string that replaces the date separator ("/" custom date and time format specifier) in a result string in a formatting operation. It also defines the date separator string in a parsing operation.

  Gets or sets the string that separates the components of a date, that is, the year, month, and day.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String[]

  A one-dimensional array of type containing the full names of the days of the week.

  The value specified for a set operation is a null reference. The value specified for a set operation is not an array with exactly 7 elements. The current instance is read-only and a set operation was attempted.

  If setting this property, the array must be one-dimensional and must have exactly seven elements.

  If a custom format string includes the "dddd" format specifier, the method includes the value of the appropriate member in place of "dddd" in the result string.

  This property is affected if the value of the property changes.

  Gets or sets a one-dimensional string array that contains the culture-specific full names of the days of the week.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.DayOfWeek To be added.

  This property is affected if the value of the property changes.

  Gets or sets the first day of the week.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the format pattern for a long date and long time value.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The "F" standard format string is an alias for the property. In other words, the custom format string assigned to this property defines the format of the result string for the "F" standard format string. For more information, see Standard Date and Time Format Strings.

  The value of the property is generated dynamically by concatenating the and properties separated by a space. This dynamic assignment occurs under the following conditions:

  If the property value is retrieved before it has been explicitly set.

  When the value of the property changes.

  When the value of the property changes.

  This property is affected if the value of the property changes.

  Gets or sets the custom format string for a long date and long time value.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String ``

  For the default invariant object, this method returns a string from the :

  Return Value

  Sunday

  "Sun"

  Monday

  "Mon"

  Tuesday

  "Tue"

  Wednesday

  "Wed"

  Thursday

  "Thu"

  Friday

  "Fri"

  Saturday

  "Sat"

  Returns the culture-specific abbreviated name of the specified day of the week based on the culture associated with the current object.

  The culture-specific abbreviated name of the day of the week represented by .

  A value.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String ``

  The era name is the name a calendar uses to refer to a period of time reckoned from a fixed point or event. For example, "A.D." or "C.E." is the current era in the Gregorian calendar.

  The valid values for are listed in the property of the appropriate class derived from . For example: displays a list of eras that are supported by this implementation.

  In the class, the abbreviated era name is the first character of the full era name. This character is either the single-character case-insensitive Latin alphabet abbreviation or the single-character Kanji abbreviation.

  Returns the string containing the abbreviated name of the specified era, if an abbreviation exists.

  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.

  The integer representing the era.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String `` is less than 1 or greater than 13.

  For the default invariant object, this method returns a string from the object.

  Return Value

  1

  "Jan"

  2

  "Feb"

  3

  "Mar"

  4

  "Apr"

  5

  "May"

  6

  "Jun"

  7

  "Jul"

  8

  "Aug"

  9

  "Sep"

  10

  "Oct"

  11

  "Nov"

  12

  "Dec"

  13

  ""

  objects can accommodate calendars with 13 months. For 12-month calendars, the empty string is always returned as the name of the 13th month.

  Returns the culture-specific abbreviated name of the specified month based on the culture associated with the current object.

  The culture-specific abbreviated name of the month represented by .

  An integer from 1 through 13 representing the name of the month to retrieve. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String[]

  This method returns an array that contains all custom format strings that correspond to standard format strings. See Standard Date and Time Format Strings for a list of the standard format strings.

  You can use the custom format strings in the array returned by the method in formatting operations. However, if you do, the string representation of a date and time value returned in that formatting operation cannot always be parsed successfully by the Parse and TryParse methods. Therefore, you cannot assume that the custom format strings returned by the method can be used to round-trip date and time values. The following example illustrates this problem. It retrieves a object that contains formatting information for the Italy (Italian) culture. It passes each custom format string in the array returned by the method to the method to create the string representation of a date and time. This example then attempts to parse this value by calling the method. As the output from the example shows, some of the custom format strings do not produce a date and time value that successfully round-trips.

  code reference: System.Globalization.DateTimeFormatInfo.GetAllDateTimePatterns#1

  To parse the string representation of a date and time that can be expressed in a number of predefined custom formats, call one of the following methods:

  The custom format strings in the array returned by the method depends on the current calendar of the culture for which the object supplies formatting information. If the calendar changes, the array returned by this method also changes.

  Returns all the standard patterns in which date and time values can be formatted.

  An array that contains the standard patterns in which date and time values can be formatted.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String[] ``

  This method returns an array containing the custom format strings that correspond to a particular standard format string. See Standard Date and Time Format Strings for a list of the standard format strings.

  You can use the custom format strings in the array returned by the method in formatting operations. However, if you do, the string representation of a date and time value returned in that formatting operation cannot always be parsed successfully by the Parse and TryParse methods. Therefore, you cannot assume that the custom format strings returned by the method can be used to round-trip date and time values. The following example illustrates this problem. It retrieves a object that contains formatting information for the Russia (Russian) culture. It calls the method for each standard format string, and then passes each custom format string in the returned array to the method to create the string representation of a date and time. This example then attempts to parse this value by calling the method. As the output from the example shows, some of the custom format strings do not produce a date and time value that successfully round-trips.

  code reference: System.Globalization.DateTimeFormatInfo.GetAllDateTimePatterns#2

  To parse the string representation of a date and time that can be expressed in a number of predefined custom formats, call one of the following methods:

  The custom format strings in the array returned by the method depends on the current calendar of the culture for which the object supplies formatting information. If the calendar changes, the array returned by this method also changes.

  Returns all the patterns in which date and time values can be formatted using the specified standard format string.

  An array containing the standard patterns in which date and time values can be formatted using the specified format string.

  A standard format string.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String ``

  For the default invariant object, this method returns a string from the object.

  Return Value

  Sunday

  "Sunday"

  Monday

  "Monday"

  Tuesday

  "Tuesday"

  Wednesday

  "Wednesday"

  Thursday

  "Thursday"

  Friday

  "Friday"

  Saturday

  "Saturday"

  Returns the culture-specific full name of the specified day of the week based on the culture associated with the current object.

  The culture-specific full name of the day of the week represented by .

  A value.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` is a null reference.

  The era name is the name a calendar uses to refer to a period of time reckoned from a fixed point or event. For example, "A.D." or "C.E." is the current era in the Gregorian calendar.

  The comparison with is case-insensitive, for example, "A.D." is equivalent to "a.d.".

  ignores punctuation in abbreviated era names, only if the is selected in and the culture uses "A.D." as the era name, that is, "A.D." is equivalent to "AD".

  compares with the full era name returned by and with the abbreviated era name returned by .

  Returns the integer representing the specified era.

  The integer representing the era, if is valid; otherwise, -1.

  The string containing the name of the era. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String `` does not represent a valid era in calendar for the current thread.

  The era name is the name a calendar uses to refer to a period of time reckoned from a fixed point or event. For example, "A.D." or "C.E." is the current era in the Gregorian calendar.

  The valid values for are listed in the property of the appropriate class derived from . For example: displays a list of eras that are supported by this implementation.

  Returns the string containing the name of the specified era.

  A string containing the name of the era.

  The integer representing the era. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object ``

  The Format(String, IFormatProvider) method supported by the base data types invoke this method when the current object is passed as the parameter. This method implements .

  Returns an object of the specified type that provides a date and time formatting service.

  The current object, if is the same as the type of the current ; otherwise, null.

  The type of the required formatting service. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.DateTimeFormatInfo ``

  This method uses the method of using an object as the parameter. If is null or if returns null, this method returns .

  Your application can get a object for a specific culture using one of the following methods:

  The property.

  The method, where is a object.

  A object can be created only for the invariant culture or for specific cultures, not for neutral cultures.

  For more information about the invariant culture, specific cultures, and neutral cultures, see the class description.

  Returns the object associated with the specified .

  A object associated with .

  The that gets the object.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String `` is less than 1 or greater than 13.

  For the default invariant object, this method returns a string from the object.

  Return Value

  1

  "January"

  2

  "February"

  3

  "March"

  4

  "April"

  5

  "May"

  6

  "June"

  7

  "July"

  8

  "August"

  9

  "September"

  10

  "October"

  11

  "November"

  12

  "December"

  13

  ""

  objects can accommodate calendars with 13 months. For 12-month calendars, the empty string is always returned as the name of the 13th month.

  Returns the culture-specific full name of the specified month based on the culture associated with the current object.

  The culture-specific full name of the month represented by .

  An integer from 1 through 13 representing the name of the month to retrieve. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.String `` To be added.

  Obtains the shortest abbreviated day name for a specified day of the week associated with the current object.

  The abbreviated name of the week that corresponds to the parameter.

  One of the values.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.DateTimeFormatInfo

  A read-only instance.

  This property does not change, regardless of the current culture. Because of this, the invariant culture's object can be used to produce consistent, culture-independent results in parsing and formatting operations on data that is multi-cultural. For example, if date and time data from multiple cultures is to be persisted in string form, it can be formatted by using the object of the invariant culture and saved. It can then be parsed by using the invariant culture's object.

  Gets the default read-only object that is culture-independent (invariant).

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is read-only; otherwise, .

  This property is read-only.

  Gets a value indicating whether the object is read-only.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the format pattern for a long date value.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property defines the culture-specific format of date strings that are returned by calls to the and methods and by composite format strings that are supplied the "D" standard format string. The following example illustrates the relationships among the following: the "D" standard format string, the custom format string returned by the property, and the culture-specific representation of a date.

  code reference: System.Globalization.DateTimeFormatInfo.LongDatePattern#2

  See Custom Date and Time Format Strings for individual custom format specifiers that can be combined to construct custom format strings such as "dddd, dd MMMM yyyy".

  You should set the date separator in the long date pattern to an exact string instead of using the date separator placeholder. For example, to obtain the pattern MM-DD-yyyy, set the long date pattern to "MM-DD-yyyy".

  The value of this property may change if the calendar used by a culture changes. For instance, the following example shows how the property of a object that represents the Arabic (Syria) culture changes when the object used by the culture changes.

  code reference: System.Globalization.DateTimeFormatInfo.LongDatePattern#3

  Gets or sets the custom format string for a long date value.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the format pattern for a long time value.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property defines the culture-specific format of date strings that are returned by calls to the and methods and by composite format strings that are supplied the "T" standard format string.

  We recommend that you set the time separator in the long time pattern to an exact string instead of using the time separator placeholder. For example, to obtain the pattern h-mm-ss, set the long date pattern to "h-mm-ss".

  Gets or sets the custom format string for a long time value.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the format pattern for a month and day value.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property defines the culture-specific format of date strings that are returned by calls to the and methods and by composite format strings that are supplied the "m" and "M" standard format strings.

  This property is affected if the value of the property changes.

  We recommend that you set the date separator in the month and day pattern to an exact string instead of using the date separator placeholder. For example, to obtain the pattern MM-DD, set the month and day pattern to "MM-DD".

  Gets or sets the custom format string for a month and day value.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.String[] To be added.

  In some languages, a month name that is part of a date appears in the genitive case. For example, a date in the Russian (Russia) or "ru-RU", culture consists of the day number and the genitive month name, such as 1 Января.

  If you set the property, you must also set the property.

  Gets or sets a string array of month names associated with the current object.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String[]

  A one-dimensional array of type containing the full names of the months. For cultures with 12-month calendars the 13th element of the array is an empty string.

  The value specified for a set operation is a null reference. The value specified for a set operation is not an array with exactly 13 elements. The current instance is read-only and a set operation was attempted.

  When this property is set, the array must be one-dimensional and must have exactly 13 elements. objects accommodate calendars with 13 months.

  If you set the property, you must also set the property.

  If the custom pattern includes the format pattern "MMMM", displays the value of in place of the "MMMM" in the format pattern.

  This property is affected if the value of the property changes.

  Gets or sets a one-dimensional array of type containing the culture-specific full names of the months.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.String To be added. To be added.

  Gets the native name of the calendar associated with the current object.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  The designator for hours that are after noon.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property is used for all times from 12:00:00 (noon) to 23:59:59.999.

  If the custom pattern includes the format pattern "tt" and the time is after noon, displays the value of in place of the "tt" in the format pattern. If the custom pattern includes the format pattern "t", only the first character of is displayed. Your application should use "tt" for languages for which it is necessary to maintain the distinction between AM and PM. An example is Japanese, for which the AM and PM designators differ in the second character instead of the first character.

  For cultures that do not use a PM designator, this property returns an empty string.

  Gets or sets the string designator for hours that are "post meridiem" (after noon).

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.DateTimeFormatInfo `` is a null reference.

  This wrapper prevents any modifications to .

  Returns a read-only wrapper.

  A read-only wrapper.

  The object to wrap. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added.

  The property defines the culture-specific format of date strings that are returned by calls to the and methods and by composite format strings that are supplied the "r" and "R" standard format strings.

  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.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` ``

  The method defines the custom format strings that correspond to a particular standard date and time format string. If a call to a date and time formatting method includes the standard date and time format string specified by , the method uses the first element in the array to define the format of the resulting string.

  The Parse and TryParse methods do not fully iterate all strings in when parsing the string representation of a date and time. If you require a date and time string to have particular formats in a parsing operation, you should pass the array of valid formats to the , , , or method.

  You can define custom format strings that correspond to the "d", "D", "t", "T", and "y" or "Y" standard date and time format strings. If the value of is any other standard format string, the method throws an .

  If your custom date and time format strings include date separators, you should explicitly specify a date separator instead of relying on the parsing or formatting method that replaces the "/" custom format specifier with a particular date separator. For example, to obtain the pattern MM-DD-yyyy, use the pattern "MM-DD-yyyy".

  Sets the custom date and time format strings that correspond to a specified standard format string.

  An array of custom format strings. The standard format string associated with the custom format strings specified in the parameter.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the format pattern for a short date value.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property defines the culture-specific format of date strings that are returned by calls to the and methods and by composite format strings that are supplied the "d" standard format string.

  This property is affected if the value of the property changes.

  Gets or sets the custom format string for a short date value.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.String[] To be added. To be added.

  Gets or sets a string array of the shortest unique abbreviated day names associated with the current object.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the format pattern for a short time value.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property defines the culture-specific format of date strings that are returned by calls to the and methods and by composite format strings that are supplied the "t" standard format string.

  We recommend that you set the time separator in the short time pattern to an exact string instead of using the time separator placeholder. For example, to obtain the pattern h-mm-ss, set the short time pattern to "h-mm-ss".

  Gets or sets the custom format string for a short time value.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added.

  The property defines the culture-specific format of date strings that are returned by calls to the and methods and by composite format strings that are supplied the "s" standard format string.

  Gets the custom format string for a sortable date and time value.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  The to use to separate the components of time; that is, the hour, the minutes and the seconds.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  If the custom pattern includes the format pattern ":", displays the value of in place of the ":" in the format pattern.

  The time separator is derived from the property. We recommend that you set the time separator in short or long time patterns to an exact string instead of using the time separator placeholder. For example, to obtain the pattern h-mm-ss, set the pattern to "h-mm-ss". This practice also enables you to set patterns such as "h'h 'mm'm 'ss's'" (3h 36m 12s) that include multiple types of separators. The property defines the string that replaces the time separator (":" custom date and time format specifier) in a result string in a formatting operation. It also defines the time separator string in a parsing operation.

  Gets or sets the string that separates the components of time, that is, the hour, minutes, and seconds.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added.

  The property defines the format of date strings that are returned by calls to the and methods and by composite format strings that are supplied the "u" standard format string. It can be used to display dates and times in a sortable order with the universal time designator "Z" at the end. The format is sortable because it uses leading zeros for year, month, day, hour, minute, and second. The custom format string ("yyyy'-'MM'-'dd HH':'mm':'ss'Z'") is the same regardless of culture or format provider.

  Gets the custom format string for a universal, sortable date and time string.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  The format pattern for a year and month value.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property defines the culture-specific format of date strings that are returned by calls to the and methods and by composite format strings that are supplied the "y" and "Y" standard format strings.

  This property is affected if the value of the property changes.

  We recommend that you set the date separator in the year month pattern to an exact string instead of using the date separator placeholder. For example, to get the pattern MM-yyyy, set the year month pattern to "MM-yyyy".

  Gets or sets the custom format string for a year and month value.

  0
0