customFormat Property
Property of
dateTimePicker
Description
by selecting or entering a "custom" format via Property: customFormat
A custom format can be directly assigned to the customFormat property as a character string. For example:
d = new dateTimePicker(this) // create control,
// "this" refers to its parent container or form
d.customFormat = "MMM d, yyyy" // Assign a custom format
Alternatively, in the Form Designer, after dragging a DateTimePicker control onto a form and clicking on it so its properties appear in the Inspector, you can click on the customFormat property and than click on its tool button. This will open the DateTimePicker Custom Format dialog.
DateTimePicker Custom Format dialog:
This dialog allows the user to choose from a large number of predefined format strings in the following categories:
Date, Time, DateTime
Or by typing in formatting codes directly to create a custom format string.
here is the key to the formatting. This dialog also shows when you go into the custom format dialog via the inspector...
By clicking the dialog's Apply button, the current value in the Custom Format Entryfield will be applied to the DateTimePicker visible in the dialog, allowing the user to see the effect of the custom format string.
The DateTimePicker Custom Format dialog contains a button labelled: Expand >>
which, when pressed, will enlarge the dialog and display the codes that can be used to create a custom format string.
As long as the customFormat property is not empty, it will override the format specified by the format property.