Jul 13 2005

DateTime Methods

Category: ASP.NET 1.x | ASP.NET 2.0 - GeneralBil@l @ 23:01

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:


                    

// partType :