How to set datetimepicker value to only date in (.NET)
Posted
by salhzmzm
on Stack Overflow
See other posts from Stack Overflow
or by salhzmzm
Published on 2010-03-26T11:36:54Z
Indexed on
2010/03/26
11:43 UTC
Read the original article
Hit count: 227
Hi
I have DateTimePicker on my form and I set a value to the custom format property to "dd/MM/yyyy" ant when I run this code:
MessageBox.Show(dateTimePicker1.Value.ToString());
I get this value : "3/26/2010 1:26 PM".
How I can remove the time part from value.
I know we can use this method
dateTimePicker1.Value.ToShortDateString();
but I want to set the value property to this format "dd/MM/yyyy" so the output will be like this "26/3/2010", because I want to store the value in my DB (SQL)
How I can do that?
© Stack Overflow or respective owner