0% found this document useful (0 votes)
4 views

complete-reference-vb_net_26

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

complete-reference-vb_net_26

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Custom Formatters

Universal sortable date/time pattern displays a pattern defined by the


DateTimeFormatInfo.FullDateTimePattern property. Note that the time
displayed is for the universal time, rather than local time.
Y or y Year month pattern displays a pattern defined by the
DateTimeFormatInfo.YearMonthPattern property
Any other single character Regarded as an unknown specifier
However, be aware that adding a single character to the formatter, even a white space, such as {"u"} will
cause the format String to be interpreted as a custom formatter. You also need to take into account that
formatters are influenced by the settings in the Regional Options control panel. This means that computers
with different cultures or different date and time settings will cause different patterns to be displayed.

Table 15−6 displays the standard format strings for formatting DateTime objects. Date and time separators
displayed by formatters are defined by the DateSeparator and TimeSeparator characters associated with the
DateTimeFormat property of the current culture.

While using the formatters specified in Table 15−6 is straightforward, keep in mind that, in cases where the
InvariantCulture is referenced by the "r", "s", and "u" specifiers, the characters associated with the
DateSeparator and TimeSeparator characters do not change based on the current culture.

Custom Formatters

As mentioned earlier, custom formatters can be used to control the output format of your values. When you
use the Custom format option, special characters are used asa template to shape the output. Characters that
are not recognized are simply copied to the output. Here are some examples of custom formatters for
numerical data.

Table 15−6: Formatters for the DateTime Object

Format Specifier Culture Information Output


d en US 4/10/2001
d en NZ 10/04/2001
d de DE 10.04.2001
D en US Tuesday, April 10, 2001
T en US 3:51:24 PM
T es ES 15:51:24
f en US Tuesday, April 10, 2001 3:51 PM
f fr FR Mardi 10 avril 2001 15:51
r en US Tue, 10 Apr 2001 15:51:24 GMT
r zh SG Tue, 10 Apr 2001 15:51:24 GMT
s en US 2001 0410T15:51:24
s pt BR 20010410T15:51:24
u en US 20010410 15:51:24Z
u sv FI 20010410 15:51:24Z
m en US April 10
m ms MY 10 April

510

You might also like