Elapsed

/// <summary>
/// Get the elapsed time since the input DateTime
/// </summary>
/// <param name="input">Input DateTime</param>
/// <returns>Returns a TimeSpan value with the elapsed time since the input DateTime</returns>
/// <example>
/// TimeSpan elapsed = dtStart.Elapsed();
/// </example>
/// <seealso cref="ElapsedSeconds()"/>
public static TimeSpan Elapsed(this DateTime input)
{
        return DateTime.Now.Subtract(input);
}
Example:
DateTime dtStart = DateTime.Now;
// Do something
Console.WriteLine(dtStart.Elapsed().TotalMilliseconds);

Description

Get the elapsed time since the input DateTime

Details

Double click on the code to select all.

 

;