I had today to work with some DateTime calculations.
I need two methods:
1- Get time difference between two dates, in such a way to have the following formats in the returned value:
- Hours
- Minutes (01 -> 1 minute, 10 -> 10 minutes,...)
- Seconds
- Hours.Minutes
- Hours:Minutes:Seconds
2- Add a double value for a DateTime
- double value (7.02 -> 7 hours and 2 minutes, 7.10/7.1 -> 7 hours and 10 minutes)
- DateTime value
Check the methods below: