Will give you the difference between two dates - CSharp System

CSharp examples for System:DateTime Calculate

Description

Will give you the difference between two dates

Demo Code


using System;/*from www.  java  2s .co m*/

public class Main{
        /// <summary>
        /// Will give you the difference between two dates
        /// </summary>
        /// <param name="dateOne">
        /// The Start Date.
        /// </param>
        /// <param name="dateTwo">
        /// The End Date
        /// </param>
        /// <returns>
        /// TimeSpan object
        /// </returns>
        public static TimeSpan Diff(this DateTime dateOne, DateTime dateTwo)
        {
            var t = dateOne.Subtract(dateTwo);
            return t;
        }
}

Related Tutorials