Diff Day - CSharp System

CSharp examples for System:DateTime Day

Description

Diff Day

Demo Code


using System.Runtime.Serialization.Formatters.Binary;
using System.Configuration;
using System.Net;
using System.Net.Mail;
using System.Drawing;
using System.Xml.Xsl;
using System.Xml;
using System.Data;
using System.Data.OleDb;
using System.IO;/*w  w w.j a  va 2s.  c o m*/
using System.Web.Security;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Text;
using System.Collections;
using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;

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

Related Tutorials