The following table describes the custom format specifiers supported
by the DatePicker Control and the results they produce. The output of
these format specifiers is influenced by the locale and the settings
in the Regional Options control panel. These format specifiers can be
used in any possible combination, along with any literal string or character.
They may also be repeated in the same custom format.
|
Format specifier |
Description |
|
d |
Displays the current day of the month, measured as a number between
1 and 31, inclusive. If the day is a single digit only (1-9), then
it is displayed as a single digit. |
|
dd |
Displays the current day of the month, measured as a number between
1 and 31, inclusive. If the day is a single digit only (1-9), it
is formatted with a preceding 0 (01-09). |
|
ddd |
Displays the abbreviated name of the day for the specified DateTime.
|
|
dddd (plus any number of additional "d" characters)
|
Displays the full name of the day for the specified DateTime. |
|
h |
Displays the hour for the specified DateTime in the range
1-12. The hour represents whole hours passed since either midnight
(displayed as 12) or noon (also displayed as 12). If this format
is used alone, then the same hour before or after noon is indistinguishable.
If the hour is a single digit (1-9), it is displayed as a single
digit. No rounding occurs when displaying the hour. For example,
a DateTime of 5:43 returns 5. |
|
hh, hh (plus any number of additional "h" characters)
|
Displays the hour for the specified DateTime in the range
1-12. The hour represents whole hours passed since either midnight
(displayed as 12) or noon (also displayed as 12). If this format
is used alone, then the same hour before or after noon is indistinguishable.
If the hour is a single digit (1-9), it is formatted with a preceding
0 (01-09). |
|
H |
Displays the hour for the specified DateTime in the range
0-23. The hour represents whole hours passed since midnight (displayed
as 0). If the hour is a single digit (0-9), it is displayed as a
single digit. |
|
HH, HH (plus any number of additional "H" characters)
|
Displays the hour for the specified DateTime in the range
0-23. The hour represents whole hours passed since midnight (displayed
as 0). If the hour is a single digit (0-9), it is formatted with
a preceding 0 (01-09). |
|
m |
Displays the minute for the specified DateTime in the range
0-59. The minute represents whole minutes passed since the last
hour. If the minute is a single digit (0-9), it is displayed as
a single digit. |
|
mm, mm (plus any number of additional "m" characters)
|
Displays the minute for the specified DateTime in the range
0-59. The minute represents whole minutes passed since the last
hour. If the minute is a single digit (0-9), it is formatted with
a preceding 0 (01-09). |
|
M |
Displays the month, measured as a number between 1 and 12, inclusive.
If the month is a single digit (1-9), it is displayed as a single
digit. |
|
MM |
Displays the month, measured as a number between 1 and 12, inclusive.
If the month is a single digit (1-9), it is formatted with a preceding
0 (01-09). |
|
MMM |
Displays the abbreviated name of the month for the specified DateTime.
|
|
MMMM |
Displays the full name of the month for the specified DateTime. |
|
s |
Displays the seconds for the specified DateTime in the range
0-59. The second represents whole seconds passed since the last
minute. If the second is a single digit (0-9), it is displayed as
a single digit only. |
|
ss, ss (plus any number of additional "s" characters)
|
Displays the seconds for the specified DateTime in the range
0-59. The second represents whole seconds passed since the last
minute. If the second is a single digit (0-9), it is formatted with
a preceding 0 (01-09). |
|
t |
Displays the first character of the A.M./P.M. |
|
tt, tt (plus any number of additional "t" characters)
|
Displays the A.M./P.M. designator for the specified DateTime.
|
|
y |
Displays the year for the specified DateTime as a maximum
two-digit number. The first two digits of the year are omitted.
If the year is a single digit (1-9), it is displayed as a single
digit. |
|
yy |
Displays the year for the specified DateTime as a maximum
two-digit number. The first two digits of the year are omitted.
If the year is a single digit (1-9), it is formatted with a preceding
0 (01-09). |
|
yyyy |
Displays the year for the specified DateTime, including the
century. If the year is less than four digits in length, then preceding
zeros are appended as necessary to make the displayed year four
digits long. |
|
: |
Time separator. This will be replaced by the Time seperator specified
in the system, which normally depends on the locale |
|
/ |
Date separator. |
|
' |
Quoted string. Displays the literal value of any string between
two " ' " characters. |
|
\c |
Where c is any character, the escape character displays the
next character as a literal. The escape character cannot be used
to create an escape sequence (like "\n" for new line)
in this context. |
|
Any other character |
Other characters are written directly to the result string as literals. |