Date and Time Picker Controls

The date and time picker (DTP) is a control that displays information about dates and times, and provides users with an easy way to modify this information. Each field in the control displays a time element, such as month, day, hour, or minute. A user selects a field by tapping it with the stylus and then types a new value from the keyboard.

    

Windows CE date and time picker

The way date and time information is displayed is determined by a format string. A DTP control can display time information in any of three preset formats, or you can create custom format strings to specify a different order in which to display the fields. For more information on the three preset formats, see Preset DTP Display Formats. You can also add customized date and time information to a DTP control by using callback fields.

You create a date and time picker control by specifying DATETIMEPICK_CLASS in the lpClassName parameter to the CreateWindowEx function. This class is registered when the common control dynamic-link library (DLL) is loaded. You can use the InitCommonControls function to ensure that this DLL is loaded.

To register the date and time picker class using the InitCommonControlsEx function, specify the ICC_DATE_CLASSES flag as the dwICC member of the INITCOMMONCONTROLSEX structure you pass in the lpInitCtrls parameter.