date Time event and code for calculating day and validate start date nd end date
private void dateTimePickerEnd_ValueChanged(object sender, EventArgs e)
{
dateTimePickerEnd.MinDate = dateTimePickerStart.Value;
DateTime start = DateTime.Parse(dateTimePicker1.Text);
DateTime end = DateTime.Parse(dateTimePicker2.Text);
//dateTimePicker2.MinDate = dateTimePicker1.Value;
if (end.Day >= start.Day)
{
TimeSpan ts = end.Subtract(start);
string ss = ts.TotalDays.ToString();
string s = ts.Days.ToString();
textBox1.Text = (s);
//string time = new DateTime(ts.Ticks);
//MessageBox.Show(time);
}
2 comments:
good code
ya it is useful
Post a Comment