Get Elasped time in C#

By [)ia6l0 iii

Extension method to get the elasped time

The below method returns the elasped time given a datetime

public static TimeSpan Elapsed(this DateTime datetime)
        {
            return DateTime.Now - datetime;
        }

Related FAQs

Extension method to get the start of a day
Extension method to get the end of a day
Get Elasped time in C#  (797 Views)