How to calculate the Time and Date diffence between datetimePicker tools

  • Thread starter Thread starter mcfee12345
  • Start date Start date
M

mcfee12345

Guest
Good Day


I have 4 date time pickers two for time and the other two just for dates.For dates i have two modules DateIn and DateOut and for Time TimeIn and TimeOut.


Now i would like the user to input details for DateOut and Time Out and nothing should Happen.However , when one return in this case the weapon they should input details in Datein and TimeIn.


If the user is returns the weapon in 12 hrs the a status textbox should report "on time".

If the user fails to return in 12 hours or after 2 days the staus textbox should report 'late"

if the user fails to input the Datein or TimeIn before or in 12 hrs the staus textbox should report weapon not returned


how do i go about handling this challenge ?


Regards

private void dateTimePickerTimeIn_ValueChanged(object sender, EventArgs e)
{
DateTime from = dateTimePickerTimeOut.Value;
DateTime to = dateTimePickerTimeIn.Value;
TimeSpan Tspan = to - from;
double hrs = Tspan.Hours;
textBoxWeaponStatus.Text = (hrs).ToString();


if (Tspan.Hours > 12)
{
textBoxWeaponStatus.Text = ("Overdue Submission!");
}
else if (Tspan.Hours < 12)
{
textBoxWeaponStatus.Text = ("Ontime submission ");
}
}
}

}

Continue reading...
 
Back
Top