#1,037 – Entering Text Manually into a DatePicker
March 26, 2014 1 Comment
When using a DatePicker control, you can either use the dropdown calendar to select a date or you can manually enter a date in the text area.
When the DatePicker converts the string that you enter into a date, it uses the DateTime.Parse method, which in turn uses the valid date/time formats for your current culture to convert from a string to a date.
For example, if you set the SelectedDateFormat to Long (so that the long form of the date is displayed) and then enter “1/10/13” when in the U.S., the date is interpreted as January 10, 2013. This is because the normal short date format is month/day/year. (Note that SelectedDateFormat only dictates how the date is displayed–you can still enter it using the short format).
However, if you enter “1/10/13” and your regional settings are set to French/France, the date will be interpreted as October 1, 2013. This is because the short date format in France is day/month/year.
Hi Sean,
Do you know a way to hide the calendar button.
I want to use a DatePicker control to show the time fragment of a datetime and have no need for the button.
I use the following to show the time fragment:
Best regards
Steffen