1
Posted on 7:58 AM by Softminer and filed under ,

DateTime Dtnow;
Dtnow = DateTime.Now;

DateTime DtAgo;
DtAgo= DateTime.Now.AddDays();

TimeSpan tsDiff = Dtnow.Subtract(DtAgo);

string Diff = tsDiff.ToString() or tsDiff.Minutes.ToString();
1
Response to ... Compare DateTime in ASP.NET difference between Datetime
lingmaaki said... September 14, 2013 at 12:59 AM

try these also

DateTime newDate = new DateTime(2000, 5, 1);

String diff2 = (secondDate - firstDate).TotalDays.ToString();

source http://csharp.net-informations.com/statements/csharp-date-difference.htm

maaki