In C # form windows, I want to set DateTimePickerto a specific one timeand keep it tuned date(any one dateI choose from DateTimePicker) when the button is pressed.
eg:
Let's say that we have this date and time: 2015-08-15 08:30:00I want the button to dateremain the same and timechange to 11:30:00.
I mean, if I select any dateof DateTimePicker, and then press the button, it datewill remain the same and timechange to 11:30:00.
Please help me achieve this.
I may need to modify the following code to achieve what I want:
private void button1_Click(object sender, EventArgs e)
{
dateTimePicker1.Value = DateTime.Today.AddHours(11.5);
}
private void button1_Click(object sender, EventArgs e)
{
dateTimePicker1.Value = DateTime.Now;
}
naouf source
share