DateTimePicker Control
Description
The DateTimePicker control is used to select a date and/or time. When a date is being selected, AJAX is used to automatically update the DropDownList for the day component to have the correct number of days for the month and year displayed and, if included in the selected day format, updates the day of the week. The date and/or time can be displayed in either order on one or two lines.
Example
Select values for the different properties of the DateTimePicker below to preview what the control would look like. (NOTE: I have not added a Validator for the value you enter for the SelectedDateTime property, so if you recieve an error please make sure you have entered a valid date and/or time)

SelectedDateTime:



[SelectedDateTime]

FirstYear:
LastYear:
DayFormat:
MonthFormat:
Layout:
Use24HourFormat:
DisplaySeconds:
Properties & Methods
DateTimePickerThe DateTimePicker control is used to select a date and/or time. When a date is being selected, AJAX is used to automatically update the DropDownList for the day component to have the correct number of days for the month and year displayed and, if included in the selected day format, updates the day of the week
  • SelectedDateTime - The currently selected date and time
  • FirstYear - The first year displayed in the year DropDownList if the selected layout includes a date. If this value is greater than the year of SelectedDateTime it will be automatically adjusted
  • LastYear - The last year displayed in the year DropDownList if the selected layout includes a date. If this value is less than the year of SelectedDateTime it will be automatically adjusted
  • DayFormat - A member of the DayNameStyle enumeration specifying how and whether or not the day of the week should be displayed as part of the day DropDownList
  • MonthFormat - A member of the MonthNameStyle enumeration specifying the format for the month DropDownList
  • Layout - A member of the DTPLayout enumeration specifying the layout of the date and/or time DropDownLists
  • Use24HourFormat - A Boolean value specifying whether the time will be displayed using a 24 hour or AM/PM format
  • DisplaySeconds - A Boolean value specifying whether the seconds DropDownList should be displayed
  • LayoutIncludesDate - A ReadOnly Boolean value indicating whether the selected Layout includes the date DropDownLists
  • LayoutIncludesTime - A ReadOnly Boolean value indicating whether the selected Layout includes the time DropDownLists
DateTimePicker.DayNameStyle As ByteAn enumeration used to specify the format in which to display the day DropDownList
  • None - Displays the day as an integer
  • Full - Displays the day of the week followed by the day of the month
  • Short - Displays the day of the week abbreviation followed by the day of the month
  • FirstLetter - Displays the first letter of the day of the week followed by the day of the month
  • FirstTwoLetters - Displays the first two letters of the day of the week followed by the day of the month
DateTimePicker.MonthNameStyle As ByteAn enumeration used to specify the format in which to display the month DropDownList
  • Full - Displays the complete name of the month
  • Abbreviated - Displays the abbreviated name of the month
  • Numeric - Displays the month as a number from 1-12
DateTimePicker.DTPLayout As ByteAn enumeration used to specify the layout in which to display the date and/or time DropDownLists
  • DateTime2Line - Displays the date followed by a
    and the time
  • TimeDate2Line - Displays the time followed by a
    and the date
  • Date - Displays only the date
  • Time - Displays only the time
  • DateTime1Line - Displays the date followed by the time
  • TimeDate1Line - Displays the time followed by the date
Source Code
DateTimePicker.vb:

Remarks
Although the functionality of this control is complete, I realize that it is not yet the most visually attractive control. If anybody has any ideas as to features that would make it look nicer or easier to use, please let me know and I will be happy to try to add them.