Date Diff - CSharp System

CSharp examples for System:DateTime Diff

Description

Date Diff

Demo Code


using System.Globalization;
using System.Text.RegularExpressions;
using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;/*from   www.  j  ava2s  .co m*/

public class Main{
        public static TimeSpan DateDiff(DateTime DateTime1, DateTime DateTime2)
        {
            TimeSpan ts1 = new TimeSpan(DateTime1.Ticks);
            TimeSpan ts2 = new TimeSpan(DateTime2.Ticks);
            TimeSpan ts = ts1.Subtract(ts2).Duration();
            return ts;
        }
}

Related Tutorials