Quote:
Add the difference in hours and minutes in C#
Hours are decimal, minutes are decimal, but a time (hours + minutes) is not decimal.
But hours and minutes are linked: 1 hour is 60 minutes.
So to do 'time arithmetic', you need to handle this particularity.
You have mostly 2 possibility:
- use the standard datetime datatype, it will handle all details for you.
- create your own solution: converting the hours to minutes look the easiest.
Basically, your procedure is:
convert the times to minutes
do whatever arithmetic operation you need
covert result back to times