How can I set a DateTimePicker control to a specific date?
Just need to set the value property in a convenient place (such as InitializeComponent()
):
dateTimePicker1.Value = DateTime.Today.AddDays(-1);
If you want to set a date, DateTimePicker.Value is a DateTime object.
DateTimePicker.Value = new DateTime(2012,05,28);
This is the constructor of DateTime:
new DateTime(int year,int month,int date);
My Visual is 2012