emp = moduleEmployee.ReturnEmployeeDAO().FetchEmployeeByID(emp);
DateTime shiftStartTime = emp.Shift.StartTime;
DateTime shiftEndTime = emp.Shift.EndTime;
DateTime attTime = att.Time;
According to the above code my shiftStartTime is 11.00 PM and shiftEndTime is 7.00 AM. and attTime or signIntime is 1.00 AM. then how to calculate the difference between shiftStartTime and attTime. where the difference should be 2 hour.
please help.....
Thanks Rusho
If you subtract two DateTime objects, you get a TimeSpan.
A TimeSpan then has properties for TotalMilliseconds, TotalSeconds, etc.
You want the TimeSpan.TotalHours
int shiftHours = (attTime - shiftStartTime).TotalHours;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With