I have two string variables such as StartTime and EndTime. I need to Calculate the TotalTime by subtracting the EndTime with StartTime.
The Format of StartTime and EndTime is as like follows:
StartTime = "08:00 AM";
EndTime = "04:00 PM";
TotalTime in Hours and Mins Format.
How to calculate this using C#?
Convert them to
DateTimeand substract one from other to getTimeSpan.When i run above code it is giving me
to get what you want.