System.Globalization.DateTimeFormatInfo Class

public sealed class DateTimeFormatInfo : ICloneable, IFormatProvider

Base Types

Object
  DateTimeFormatInfo

This type implements ICloneable and IFormatProvider.

Assembly

mscorlib

Library

BCL

Summary

Defines culture-specific formats and patterns for DateTime values.

Description

DateTime values are formatted by the System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider) and System.DateTime.ToString methods according to standard or custom patterns stored in the properties of a DateTimeFormatInfo instance. The standard patterns can be accessed and modified through the associated DateTimeFormatInfo properties. [Note: The format patterns and properties of a read-only DateTimeFormatInfo instance cannot be changed. To determine whether a DateTimeFormatInfo instance is read-only, use the System.Globalization.DateTimeFormatInfo.IsReadOnly property.]

Date and time format patterns are specified using strings called format specifiers. A string is interpreted as standard format specifier if it contains exactly one standard format specifier character. If the string contains a single character and that character is not one of the standard format specifiers, an exception is thrown. If the string contains two or more characters, even if the extra characters are white spaces, the string is interpreted as a custom format specifier. Format specifiers and format patterns are case-sensitive; for example, 'g' and 'G' represent different patterns.

The following table shows the standard format specifiers and the associated format pattern defined for the invariant culture. The exact pattern produced by a format specifier is influenced by culture-specific date and/or time settings on the current system; computers with different date and time settings might display different patterns. The asterisk at the end of a format pattern indicates that the preceding character can be repeated without changing the meaning of the pattern. For example, the pattern "HH*" indicates that the strings "HH", "HHH", "HHHH", and "HHHHH" produce the same result when used with System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider) and System.DateTime.ToString methods.

Format SpecifierFormat Pattern
dMM/dd/yyyy
Ddddd*, dd MMMM* yyyy
fdddd*, dd MMMM* yyyy HH*:mm*
Fdddd*, dd MMMM* yyyy HH*:mm*:ss*
gMM/dd/yyyy HH*:mm*
GMM/dd/yyyy HH*:mm*:ss*
m, MMMMM* dd
tHH*:mm*
THH*:mm*:ss*
Udddd*, dd MMMM* yyyy HH*:mm*:ss*
y, Yyyyy MMMM*
The following table lists custom format specifiers that can be combined to construct custom patterns. If the custom pattern contains white space characters, characters enclosed in single or double quotation marks, or characters not defined in the following table, these characters are considered literals and are included in the output string unchanged. [Note: See the String class for the list of white space characters.]

Format PatternDescription
dThe day of the month as a value in the range 1-31, inclusive. Single-digit days do not have a leading zero.
ddThe day of the month as a value in the range 1-31, inclusive. Single-digit days have a leading zero.
dddThe abbreviated name of the day of the week, as defined in System.Globalization.DateTimeFormatInfo.AbbreviatedDayNames .
dddd*The full name of the day of the week, as defined in System.Globalization.DateTimeFormatInfo.DayNames .
MThe numeric month as a value in the range 1-12, inclusive. Single-digit months do not have a leading zero.
MMThe numeric month as a value in the range 1-12, inclusive. Single-digit months have a leading zero.
MMMThe abbreviated name of the month, as defined in System.Globalization.DateTimeFormatInfo.AbbreviatedMonthNames .
MMMM*The full name of the month, as defined in System.Globalization.DateTimeFormatInfo.MonthNames .
yThe year without the century (two-digit). If the value is less than 10, the year is displayed with no leading zero.
yyThe year without the century (two-digit). If the year without the century is less than 10, the year is displayed with a leading zero.
yyyyThe year including the century in four digits.
g*The name of a period or era (such as "A.D." or "B.C."). This pattern is ignored if the date to be formatted does not have an associated period or era string.
hThe hour within a 12-hour range as a value in the range 1-12, inclusive. Single-digit hours do not have a leading zero. [Note: The value represents whole hours passed since either midnight (12) or noon (12). To distinguish between values occurring before and after noon, include the "t" or "tt*" custom format specifier.]

hh*The hour within a 12-hour range as a value in the range 1-12, inclusive. Single-digit hours have a leading zero. [Note: The value represents whole hours passed since either midnight (12) or noon (12). To distinguish between values occurring before and after noon, include the "t" or "tt*" custom format specifier.]

HThe hour as a value in the range 0-23, inclusive. Single-digit hours do not have a leading zero. [Note: The value represents whole hours passed since midnight.]

HH*The hour as a value in the range 0 and 23, inclusive. Single-digit hours have a leading zero. [Note: The value represents whole hours passed since midnight.]

mThe minute as a value in the range 0-59, inclusive. Single-digit minutes do not have a leading zero. [Note: The value represents whole minutes passed since the last hour.]

mm*The minute as a value in the range 0-59, inclusive. Single-digit minutes have a leading zero. [Note: The value represents whole minutes passed since the last hour.]

sThe second as a value in the range 0-59, inclusive. Single-digit seconds do not have a leading zero. [Note: The value represents whole seconds passed since the last minute.]

ss*The second as a value in the range 0-59, inclusive. Single-digit seconds have a leading zero. [Note: The value represents whole seconds passed since the last minute.]

f Displays fractional seconds represented in one digit.
ff Displays fractional seconds represented in two digits.
fff Displays fractional seconds represented in three digits.
ffff Displays fractional seconds represented in four digits.
fffff Displays fractional seconds represented in five digits.
ffffff Displays fractional seconds represented in six digits.
fffffff Displays fractional seconds represented in seven digits.
tThe first character of the AM/PM designator defined in the DateTimeFormatInfo property System.Globalization.DateTimeFormatInfo.AMDesignator or System.Globalization.DateTimeFormatInfo.PMDesignator. [Note: If the total number of hours passed since midnight is less than 12, the A.M. designator is used; otherwise the P.M. designator is used.]

tt*The AM/PM designator defined in the DateTimeFormatInfo property System.Globalization.DateTimeFormatInfo.AMDesignator or System.Globalization.DateTimeFormatInfo.PMDesignator. [Note: If the total number of hours passed since midnight is less than 12, the A.M. designator is used; otherwise the P.M. designator is used.]

zThe time zone offset (hour only) from the universal time coordinate (UTC) time (Greenwich Mean Time) as a value in the range -12 to +13, inclusive. Single-digit hours do not have a leading zero. [Note: The value always includes a leading sign (zero is '+0'), indicating hours ahead of UTC time (+) or hours behind UTC time (-). The offset takes Daylight Savings Time into account.]

zzThe time zone offset (hour only) from the UTC time (Greenwich Mean Time) as a value in the range -12 to +13, inclusive. Single-digit hours have a leading zero. [Note: The value always includes a leading sign (zero is '+0'), indicating hours ahead of UTC time (+) or hours behind UTC time (-). The offset takes Daylight Savings Time into account.]

zzz* The full time zone offset (hour and minutes) from the UTC time (Greenwich Mean Time) as a value in the range -12:00 to +13:00, inclusive. Single-digit hours and minutes have leading zeros. [Note: The value always includes a leading sign (zero is '+0'), indicating hours ahead of UTC time (+) or hours behind UTC time (-). The offset takes Daylight Savings Time into account.]

:The invariant culture time separator defined in System.Globalization.DateTimeFormatInfo.TimeSeparator .
/The invariant culture date separator defined in the System.Globalization.DateTimeFormatInfo.DateSeparator .
%cc represents a single custom format character. Produces the custom format pattern associated with the format character c. The %c specifier provides a mechanism for specifying a single custom format character and having it recognized as a custom specifier. This format is intended for characters that define both a custom and a standard format. Note that a format string containing exactly one such character will be interpreted as a standard format specifier unless prefaced with the %. [Note: For example, for the invariant culture, "%d" produces the single or double digit date, while "d" produces the date in "MM/dd/yyyy" format. Without the %, a format string containing one character would have to include leading or trailing white space to be interpreted as a custom specifier because custom formats are required to have two or more characters.]

\cc represents any character predefined as part of a format specifier. Prevents the character from being interpreted as a format specifier (the character is treated as a literal). [Note: In programming languages where the backslash ('\') character is used to specify control sequences such as newline (\n), the backslash character is required to be specified twice. For example, in C#, "\d" is coded as "\\d".]

'xx' or "xx"xx represents a string of characters of any length. The characters are treated as literals.

See Also

System.Globalization Namespace

Members

DateTimeFormatInfo Constructors

DateTimeFormatInfo Constructor

DateTimeFormatInfo Methods

DateTimeFormatInfo.Clone Method
DateTimeFormatInfo.GetAbbreviatedMonthName Method
DateTimeFormatInfo.GetEra Method
DateTimeFormatInfo.GetEraName Method
DateTimeFormatInfo.GetFormat Method
DateTimeFormatInfo.GetMonthName Method
DateTimeFormatInfo.ReadOnly Method

DateTimeFormatInfo Properties

DateTimeFormatInfo.AMDesignator Property
DateTimeFormatInfo.AbbreviatedDayNames Property
DateTimeFormatInfo.AbbreviatedMonthNames Property
DateTimeFormatInfo.CurrentInfo Property
DateTimeFormatInfo.DateSeparator Property
DateTimeFormatInfo.DayNames Property
DateTimeFormatInfo.FullDateTimePattern Property
DateTimeFormatInfo.InvariantInfo Property
DateTimeFormatInfo.IsReadOnly Property
DateTimeFormatInfo.LongDatePattern Property
DateTimeFormatInfo.LongTimePattern Property
DateTimeFormatInfo.MonthDayPattern Property
DateTimeFormatInfo.MonthNames Property
DateTimeFormatInfo.PMDesignator Property
DateTimeFormatInfo.ShortDatePattern Property
DateTimeFormatInfo.ShortTimePattern Property
DateTimeFormatInfo.TimeSeparator Property
DateTimeFormatInfo.YearMonthPattern Property


DateTimeFormatInfo Constructor

public DateTimeFormatInfo();

Summary

Constructs and initializes a new instance of the DateTimeFormatInfo class that is culture-independent (invariant).

Description

The new instance of DateTimeFormatInfo is not read-only, and its properties can be modified with user-defined patterns.

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.Clone Method

public object Clone();

Summary

Creates a copy of the current instance.

Return Value

A new DateTimeFormatInfo instance with property values equal to the property values of the original DateTimeFormatInfo instance.

Description

The System.Globalization.DateTimeFormatInfo.Clone method creates a new instance of the same type as the current instance, and then copies the contents of each of the current instance's non-static fields.

The new instance is not read-only, and its properties can be modified with user-defined patterns.

[Note: This method is implemented to support the ICloneable interface.]

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.GetAbbreviatedMonthName Method

public string GetAbbreviatedMonthName(int month);

Summary

Gets the abbreviated name of the specified month based on the culture of the current thread.

Parameters

month
A Int32 from 1 through 13 representing the month name to retrieve.

Return Value

A String containing the abbreviated name of the month represented by month. For cultures with 12-month calendars, the empty string is returned as the name of the 13th month.

Exceptions

Exception TypeCondition
ArgumentOutOfRangeExceptionmonth is less than 1 or greater than 13.

Description

For the default (culture-invariant) DateTimeFormatInfo instance, this method returns one of the following strings:

monthReturn 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""
[Note: This method supports calendars with 13 months.]

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.GetEra Method

public int GetEra(string eraName);

Summary

Gets a Int32 representing the specified era.

Parameters

eraName
A String containing the name of the era.

Return Value

A Int32 representing the era. If eraName is invalid, returns -1.

Exceptions

Exception TypeCondition
ArgumentNullExceptioneraName is a null reference.

Description

The value specified for eraName is case-insensitive.

[Note: An era name is a culturally specific name for a period of time marked by distinctive characters or reckoned from a fixed point or event. For example "A.D." and "B.C." are two eras of the Gregorian calendar.]

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.GetEraName Method

public string GetEraName(int era);

Summary

Gets the String containing the name of the specified era.

Parameters

era
A Int32 representing the era.

Return Value

A String containing the name of the era.

Exceptions

Exception TypeCondition
ArgumentOutOfRangeExceptionera does not represent a valid era in calendar for the current thread.

Description

[Note: An era name is a culturally specific name for a period of time marked by distinctive characters or reckoned from a fixed point or event. For example "A.D." and "B.C." are two eras of the Gregorian calendar.]

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.GetFormat Method

public object GetFormat(Type formatType);

Summary

Returns an object of the specified type that provides DateTime formatting services.

Parameters

formatType
The Type of the formatting object to be returned.

Return Value

The current instance, if formatType is of type DateTimeFormatInfo; otherwise, a null reference.

Description

[Note: This method is implemented to support the IFormatProvider interface.]

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.GetMonthName Method

public string GetMonthName(int month);

Summary

Gets the full name of the specified month based on the culture of the current thread.

Parameters

month
A Int32 from 1 through 13 representing the month name to retrieve.

Return Value

A String containing the full name of the month represented by month. For cultures with 12-month calendars the empty string is returned as the name of the 13th month.

Exceptions

Exception TypeCondition
ArgumentOutOfRangeExceptionmonth is less than 1 or greater than 13.

Description

For the default (culture invariant) DateTimeFormatInfo instance, this method returns one of the following strings:

monthReturn 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""
[Note: This method supports calendars with 13 months.]

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.ReadOnly Method

public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi);

Summary

Returns a read-only copy of the specified instance of DateTimeFormatInfo .

Parameters

dtfi
The DateTimeFormatInfo to copy.

Return Value

A read-only instance of DateTimeFormatInfo that is a copy of dtfi.

Exceptions

Exception TypeCondition
ArgumentNullExceptiondtfi is a null reference.

Description

[Note: Use a read-only DateTimeFormatInfo copy to prevent modifications to the specified instance.]

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.AMDesignator Property

public string AMDesignator { get; set; }

Summary

Gets or sets the String culture-specific designator for hours that are "ante meridiem" (before noon).

Property Value

The String designator for hours that are before noon.

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.AMDesignator returns the String "AM".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.AbbreviatedDayNames Property

public string[] AbbreviatedDayNames { get; set; }

Summary

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

Property Value

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

Exceptions

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

Description

The array specified in a set operation is required to be one-dimensional and have exactly seven elements. The first element of the array is the abbreviated day name for Sunday, and the last element is the name for Saturday.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.AbbreviatedDayNames is a String array that contains "Sun", "Mon", "Tue", "Wed", "Thu", "Fri" and "Sat".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.AbbreviatedMonthNames Property

public string[] AbbreviatedMonthNames { get; set; }

Summary

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

Property Value

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

Exceptions

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

Description

The Array specified in a set operation is required to be one-dimensional and have exactly 13 elements.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.AbbreviatedMonthNames is a String array that contains "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" and "".

[Note: The array returned by this property has 13 elements to support calendars with 13 months.]

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.CurrentInfo Property

public static DateTimeFormatInfo CurrentInfo { get; }

Summary

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

Property Value

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

Description

This property is read-only.

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.DateSeparator Property

public string DateSeparator { get; set; }

Summary

Gets or sets the culture-specific String to use to separate the year, month, and day components of a date.

Property Value

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

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.DateSeparator is "/".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.DayNames Property

public string[] DayNames { get; set; }

Summary

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

Property Value

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

Exceptions

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

Description

The array specified in a set operation is required to be one-dimensional and have exactly seven elements. The first element of the array is the abbreviated day name for Sunday, and the last element is the name for Saturday.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.DayNames is a String array that contains "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" and "Saturday".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.FullDateTimePattern Property

public string FullDateTimePattern { get; set; }

Summary

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

Property Value

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

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider) and System.DateTime.ToString methods associate the format pattern returned by this property with the 'F' format character.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.FullDateTimePattern is "dddd, dd MMMM yyyy HH:mm:ss".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.InvariantInfo Property

public static DateTimeFormatInfo InvariantInfo { get; }

Summary

Gets a culture invariant instance of DateTimeFormatInfo that is read-only.

Property Value

A read-only DateTimeFormatInfo instance.

Description

This property is read-only.

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.IsReadOnly Property

public bool IsReadOnly { get; }

Summary

Gets a Boolean value indicating whether the current DateTimeFormatInfo instance is read-only.

Property Value

true if the DateTimeFormatInfo is read-only; otherwise, false .

Description

This property is read-only.

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.LongDatePattern Property

public string LongDatePattern { get; set; }

Summary

Gets or sets the format pattern for a long date value.

Property Value

A String containing the format pattern for a long date value.

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider) and System.DateTime.ToString methods associate the format pattern returned by this property with the 'D' format character.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.LongDatePattern is "dddd, dd MMMM yyyy".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.LongTimePattern Property

public string LongTimePattern { get; set; }

Summary

Gets or sets the format pattern for a long time value.

Property Value

A String containing the format pattern for a long time value.

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider) and System.DateTime.ToString methods associate the format pattern returned by this property with the 'T' format character.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.LongTimePattern is "HH:mm:ss".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.MonthDayPattern Property

public string MonthDayPattern { get; set; }

Summary

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

Property Value

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

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider) and System.DateTime.ToString methods associate the format pattern returned by this property with the 'm' and 'M' format characters.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.MonthDayPattern is "MMMM dd".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.MonthNames Property

public string[] MonthNames { get; set; }

Summary

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

Property Value

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

Exceptions

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

Description

The array specified in a set operation is required be one-dimensional and have exactly 13 elements.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.MonthNames is a String array that contains "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" and "".

[Note: The array returned by this property has 13 elements to support calendars with 13 months.]

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.PMDesignator Property

public string PMDesignator { get; set; }

Summary

Gets or sets the culture-specific String designator for hours that are "post meridiem" (after noon).

Property Value

The String designator for hours that are after noon.

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.PMDesignator is "PM".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.ShortDatePattern Property

public string ShortDatePattern { get; set; }

Summary

Gets or sets the format pattern for a short date value.

Property Value

A String containing the format pattern for a short date value.

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider) and System.DateTime.ToString methods associate the format pattern returned by this property with the 'd' format character.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.ShortDatePattern is "MM/dd/yyyy".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.ShortTimePattern Property

public string ShortTimePattern { get; set; }

Summary

Gets or sets the format pattern for a short time value.

Property Value

A String containing the format pattern for a short time value.

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider) and System.DateTime.ToString methods associate the format pattern returned by this property with the 't' format character.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.ShortTimePattern is "HH:mm".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.TimeSeparator Property

public string TimeSeparator { get; set; }

Summary

Gets or sets the culture-specific String to use to separate the components of time values (hour, minutes, seconds).

Property Value

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

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.TimeSeparator is ":".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace

DateTimeFormatInfo.YearMonthPattern Property

public string YearMonthPattern { get; set; }

Summary

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

Property Value

The format pattern for a year and month value.

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Description

The System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider) and System.DateTime.ToString methods associate the format pattern returned by this property with the 'y' and 'Y' format character.

The property value of the culture invariant System.Globalization.DateTimeFormatInfo.YearMonthPattern is "yyyy MMMM".

See Also

System.Globalization.DateTimeFormatInfo Class, System.Globalization Namespace