1
Reply

Using the customFormat attribute of the datTimePicker

Liam

Liam

Apr 13 2009 10:32 AM
2.9k
Hey people,

Maybe you can help me with this, at the moment within the code of my add button (which updates a database row) I have

m_dtContacts.Rows[m_rowPosition]["DateBooked"] = dateTimePicker.Value;

So this obviously inputs the value that is selected in the dateTimePicker. But then this Displays the date as dd/mm/yyyy which is what I want but then it puts the time after it like this : 12/03/2009 00:00:00.

What i'd like to know is how i can display the Date, without the time following after it i already tried this code which just puts the same Value in:

dateTimePicker.Format = DateTimePickerFormat.Custom;

//Display the date for example, as "Mon 26 Feb 2001".

dateTimePicker.CustomFormat = "ddd dd MMM yyyy";


At this stage i get stuck, so if anyone knows how i could fix it it would be greatly appreciated :)


Answers (1)