• Hello and welcome to our new forums. We upgraded our forum sites to a more robust and modern system which we hope you will enjoy. Be sure to check out your profile by clicking the button on the top right and configure your preferences, signature, time zone, avatar, etc. as you wish. If you need help with using this new forum'ware try the help link on the bottom right.

    Click here to review your account now.

datetime picker info


Active member
Nov 24, 2005
South Afica
Programming Experience
I have a form with a button, textbox and a datetimepicker.

I want to click on datetimepicker and choose a date, then click on button, then the date should show in the textbox.
After I have click on datetimepicker and then the button ,it shows the date, but in the wrong format.

Here is my code, I am using it in my button code

DateTimePickerOutDate.Format = DateTimePickerFormat.Custom
DateTimePickerOutDate.CustomFormat = "dd MMMM yyyy"
txtSearchDateOut.Text = DateTimePickerOutDate.Value
The date that I want it to display must be dd mmmm yyyy (09 October 2012), but is shows in the textbox as 10/09/2012 2:43:22 PM

What am I doing wrong, is there someplace that I must change the datetimepicker values as well.


VB.NET Forum Moderator
Staff member
Aug 17, 2004
Sydney, Australia
Programming Experience
The Value property of the DateTimePicker returns a DateTime. It's just a DateTime like any other, which no specific knowledge of the DateTimePicker or the format it displays its contents in. If you want the data displayed in the TextBox using the same format as the DateTimePicker then use the Text property of the DateTimePicker, which is already a formatted String, rather than the Value.
Top Bottom