In this post we can see how to get the difference between the two dates
DateTime dt1 = DateTime.Now;
DateTime dt2 = DateTime.Now.AddDays(3).AddSeconds(34);
System.Threading.Thread.Sleep(4000);
TimeSpan span = dt2 - dt1;
Console.WriteLine("
Days: " + span.Days +" Min: "+span.Minutes+" Sec: "+span.Seconds);
Console.Read();
Add the Span to the Date:
DateTime Sample = DateTime.Now.AddDays(4);
Sample.Add(span);
No comments:
Post a Comment