Date and Time Picker.
The Date and Time Picker is used to select a single date or time. For dates a drop-down calendar is used:
For times, scroller buttons are provided:
DateTimePicker - Methods & Properties
NewDateTimePicker
Creates a new DateTimePicker and returns the handle of the new control.
| hWnd of parent form (or frame) or placeholder (hWnd) | |
| Specifies the style of the window being created. | |
| If the style PC_PLACEHOLDER is specified, then hWnd refers to the evb control to be used as a as placeholder. The new DateTimePicker control will be placed on the form at the same location as this control, with the same size and font. The placeholder control is then hidden. Note: If PC_PLACEHOLDER style is not given, then hWnd specifies the parent window for the new control. The new control is positioned according to the current values of PPCtrl.Left, PPCtrl.Top, PPCtrl.Width and PPCtrl.Height. The font of the parent window is used. |
Date
Retrieves/Sets the currently selected time from the date and time picker (DTP) control specified by hWnd. PPCtrl.Date(dt1)=now
MinDate, MaxDate
Retrieves/Sets the current minimum and maximum allowable times/dates for the date and time picker (DTP) control specified by hWnd.
Format
Sets the display of the date and time picker (DTP) control specified by hWnd based on a given format string.
DateTimePicker – Styles
DTS_LONGDATEFORMAT
Displays the date in long format. The default format string for this style is defined in the long date setting in the regional settings, which produces output like "Friday, April 19, 1996".
DTS_RIGHTALIGN
The drop-down month calendar will be right-aligned with the control instead of left-aligned, which is the default.
DTS_SHOWNONE
It is possible to have no date currently selected in the control. With this style, the control displays a check box that users can check once they have entered or selected a date. Until this check box is checked, the application will not be able to retrieve the date from the control because, in essence, the control has no date.
DTS_SHORTDATEFORMAT
Displays the date in short format. The default format string for this style is defined in the short date setting in the regional settings, which produces output like "4/19/96".
DTS_SHORTDATECENTURYFORMAT
Similar to the DTS_SHORTDATEFORMAT style, except the year is a four-digit field. The default format string for this style is based on the short date setting in the regional settings. The output looks like: "4/19/1996".
DTS_TIMEFORMAT
Displays the time. The default format string for this style is defined by the time setting in the regional settings, which produces output like "5:31:42 PM".
DTS_UPDOWN
Places an up-down control to the right of the DTP control to modify date-time values. This style can be used in place of the drop-down month calendar, which is the default style.