How to get only the date value from a Windows Forms DateTimePicker control?

I’m assuming you mean a datetime picker in a winforms application.

in your code, you can do the following:

string theDate = dateTimePicker1.Value.ToShortDateString();

or, if you’d like to specify the format of the date:

string theDate = dateTimePicker1.Value.ToString("yyyy-MM-dd");

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)