DateTimeFormatInfo

DateTimeFormatInfo


Provides a repository of formatting information to be used in formatting cDateTime and Date values to match that of a specific locale.


Remarks

Formatting dates can vary greatly across multiple cultures. Each culture can provide formatting information that is specific to itself. A DateTimeFormatInfo object contains all the formatting information necessary to create a wide range of formatted dates and times. Also, this class provides a Format method to allow for directly formatting dates and times.
The following table lists standard formats to be used when formatting dates. The format characters are associated with the DateTimeFormatInfo' class in representing date formats. The characters are case-sensitive.'

This table is taken from Microsoft .NET 1.1 MSDN.' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
Format CharacterDescription and Associated Properties
dShortDatePattern
DLongDatePattern
fFull Date and Time (Long Date and Short Time)
FFullDateTimePattern (Long Date and Long Time)
gGeneral (Short Date and Short Time)
GGeneral (Short Date and Long Time)
m,MMonthDayPattern
r,RRFC1123Pattern
sSortableDateTimePattern
tShortTimePattern
TLongTimePattern
uUniversalSortableDateTimePattern
UFull Date and Time (Long Date, Long Time) using universal time
y,YYearMonthPattern
' The following table lists custom formatting characters that are used' to create custom date formats. Characters and whitespace contained within' a pair of single or double quotes will be included in the output. The format' characters are case-sensitive, so "MM" is recognized, but "mm" is not.' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
Format CharacterDescription and Associated Properties
dThe day of the month. Single-digit days will not have a leading zero.
ddThe day of the month. Single-digit days will have a leading zero.
dddThe abbreviated name of the day of the week, as defined in AbbreviatedDayNames.
ddddThe full name of the day of the week, as defined in DayNames.
MThe numeric month. Single-digit months will not have a leading zero.
MMThe numeric month. Single-digit months will have a leading zero.
MMMThe abbreviated name of the month, as defined in AbbreviatedMonthNames.
MMMMThe full name of the month, as defined in MonthNames.
yThe year without the century. If the year without the century is less than 10, the year is displayed with no leading zero.
yyThe year without the century. If the year without the century is less than 10, the year is displayed with a leading zero.
yyyyThe year in four digits, including the century.
hThe hour in a 12-hour clock. Single-digit hours will not have a leading zero.
hhThe hour in a 12-hour clock. Single-digit hours will have a leading zero.
HThe hour in a 24-hour clock. Single-digit hours will not have a leading zero.
HHThe hour in a 24-hour clock. Single-digit hours will have a leading zero.
mThe minute. Single-digit minutes will not have a leading zero.
mmThe minute. Single-digit minutes will have a leading zero.
sThe second. Single-digit seconds will not have a leading zero.
ssThe second. Single-digit seconds will have a leading zero.
fThe fraction of a second in single-digit precision. The remaining digits are truncated.
ffThe fraction of a second in double-digit precision. The remaining digits are truncated.
fffThe fraction of a second in three-digit precision. The remaining digits are truncated.
ffffThe fraction of a second in four-digit precision. The remaining digits are truncated.
fffffThe fraction of a second in five-digit precision. The remaining digits are truncated.
ffffffThe fraction of a second in six-digit precision. The remaining digits are truncated.
fffffffThe fraction of a second in seven-digit precision. The remaining digits are truncated.
tThe first character in the AM/PM designator defined in AMDesignator or PMDesignator, if any.
ttThe AM/PM designator defined in AMDesignator or PMDesignator, if any.
zThe time zone offset ("+" or "-" followed by the hour only). Single-digit hours will not have a leading zero. For example, Pacific Standard Time is "-8".
zzThe time zone offset ("+" or "-" followed by the hour only). Single-digit hours will have a leading zero. For example, Pacific Standard Time is "-08".
zzzThe full time zone offset ("+" or "-" followed by the hour and minutes). Single-digit hours and minutes will have leading zeros. For example, Pacific Standard Time is "-08:00".
:The default time separator defined in TimeSeparator.
/The default date separator defined in DateSeparator.
%cWhere c is a format pattern if used alone. The "%" character can be omitted if the format pattern is combined with literal characters or other format patterns.
\cWhere c is any character. Displays the character literally. To display the backslash character, use "\\".

See Also

Project VBCorLib Overview | DateTimeFormatInfoStatic | ICloneable | IFormatProvider

Implements:

ICloneable 
IFormatProvider 
IObject 

Public:

Properties:

NameDescription
 AbbreviatedDayNames (get)Returns an array of abbreviated weekday names. 
 AbbreviatedDayNames (let)Sets the weekday names to be used by this FormatProvider. 
 AbbreviatedMonthNames (get)Returns an array of names for all the months. 
 AbbreviatedMonthNames (let)Sets the abbreviated month names to be used by the formatter. 
 AMDesignator (get)Returns the string that is displayed for times from 12:00:00 AM to 11:59:59 AM. 
 AMDesignator (let)Sets the string that is display for times from 12:00:00 AM to 11:59:59 AM. 
 Calendar (get)Returns the Calendar associated with this DateTimeFormatInfo
 Calendar (set)Sets the calendar associated with this DateTimeFormatInfo
 CalendarWeekRule (get)Returns the definition of the first week of the calendar year. 
 CalendarWeekRule (let)Sets the definition of the first week for the calendar year. 
 DateSeparator (get)Returns the string that is displayed when separating the components of a date, such as year, month, day. 
 DateSeparator (let)Sets the string that is display when separating the components of a date, such as year, month, day. 
 DayNames (get)Returns the names of the weekdays. 
 DayNames (let)Sets the names for the weekdays. 
 FirstDayOfWeek (get)Returns the first day of the week. 
 FirstDayOfWeek (let)Sets the first day of the week. 
 FullDateTimePattern (get)Returns a formatting pattern that represents a full date and time associated with the F' formatting command. 
 FullDateTimePattern (let)Sets the formatting pattern used for a full date and time formatting, and is associated with the F' formatting command. 
 IsReadOnly (get)Returns if this formatter is ReadOnly. 
 LongDatePattern (get)Returns a pattern for formatting just the date portion and is associated with the D' formatting command. 
 LongDatePattern (let)Sets a pattern used for formatting just the date portion and is associated with the D' formatting command. 
 LongTimePattern (get)Returns a pattern used in formatting the time portion and is associated with the T' formatting command. 
 LongTimePattern (let)Sets the pattern used to format the time part when using the T' formatting command. 
 MonthDayPattern (get)Returns the month/day pattern associated with either m' or 'M' formatting commands. 
 MonthDayPattern (let)Sets the month/day formatting pattern associated with either m' or 'M' formatting commands. 
 MonthNames (get)Returns the full names for the months of the year. 
 MonthNames (let)Sets the full month names to be used by the formatter. 
 PMDesignator (get)Returns the string diplayed for times between 12:00:00 PM and 12:00:00 AM. 
 PMDesignator (let)Sets the string display for times between 12:00:00 PM and 12:00:00 AM. 
 RFC1123Pattern (get)Returns the pattern as specified by RFC-1123 and associated with the r' or 'R' formatting commands. 
 ShortDatePattern (get)Returns the pattern for short date formatting associated with the d' formatting command. 
 ShortDatePattern (let)Sets the pattern used in formatting dates with the d' formatting command. 
 ShortTimePattern (get)Returns the formatting pattern for a short time using the t' formatting command. 
 ShortTimePattern (let)Sets the formatting pattern for a short time using the t' formatting command. 
 SortableDateTimePattern (get)Returns a pattern that can be used in string sorting to produce an ascending sort with string based dates and times. This pattern is associated with the s' formatting command. 
 TimeSeparator (get)Returns the separator of time components, such as hours, minutes, seconds. 
 TimeSeparator (let)Set the separator for time components. 
 UniversalSortableDateTimePattern (get)Returns a string sortable pattern that is associated with the u' or 'U' formatting commands. 
 YearMonthPattern (get)Returns the pattern representing a YearMonth combination. This is associated with the y' or 'Y' formatting commands. 
 YearMonthPattern (let)Sets the pattern that represents a YearMonth combination. This is associated with the y' or 'Y' formatting commands. 

Methods:

NameDescription
 CloneReturns a clone of this instance. If this instance is ReadOnly, the clone will also be ReadOnly. 
 EqualsReturns a boolean indicating if the value and this object instance are the same instance. 
 formatFormats a cDateTime object or Date value in the pattern specified by the formatting command. If no command is specified, then G' is assumed. If the command cannot be found, then a custom pattern is assumed. 
 GetAbbreviatedDayNameReturns the abbreviated name for the specified day-of-the-week. 
 GetAbbreviatedEraNameReturns the name of the Era specified. 
 GetAbbreviatedMonthNameRetrieves the abbreviated name for a given month. 
 GetAllDateTimePatternsReturns all of the patterns for a specified formatting command. Or if no command is specified, then all of the patterns are returned. 
 GetDayNameReturns the full name for the day of the week. 
 GetEraReturns the numeric era value based on the name provided. 
 GetEraNameReturns the full name of the specified. 
 GetFormatReturns a format provider for the specified format type. 
 GetHashCodeReturns a pseudo-unique number identifying this instance. 
 GetMonthNameReturns the full name of the specified month. 
 ToStringReturns a string representation of this object instance.