The information in this article applies to:
SUMMARYThe CustomFormat property of the DateTimePicker control is case-sensitive. MORE INFORMATION
As an example, if you use a CustomFormat such as mm/dd/yy, you will get the
correct day and year but not the month. This is because the symbol "mm"
refers to minutes instead of months. Because all dates without a
time-specified default to midnight, the hours, minutes, and seconds will
all have a value of zero.
instead of:
as you might expect. To specify a month in the CustomFormat, use a capital
letter "M."Similarly, to see time on a 12-hour clock, use a lower case "h" for hours. Or use upper-case "H" for hours to view time on a 24-hour clock. If you want to include any literal text in your custom format, it should be enclosed in single quotes. While many characters will display correctly without using single quotes, such as spaces, slashes, digits, etc., the quotes are recommended to ensure a proper format. If you want to have a single quote display in your format, use two single quotes together. Also, only three 'y' characters are required for a four-digit year, but it is also fine to use four or more 'y' characters for year because the extras are ignored. The CustomFormat property is a String. So, when setting it in code, the entire custom format must be enclosed in a pair of double quotes. For example:
Step-by-Step Example
REFERENCES
Search On-line Help for DateTimePicker and select the first topic, "Using
the DateTimePicker Control." The discussion of the CustomFormat property
lists the supported format strings and their effects. Q187233 BETA-BUG: DateTimePicker's CustomFormat May Be Ignored Additional query words: kbDSupport kbDSD kbCtrl kbUsage kbVB600
Keywords : kbGrpVB |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |