TimeSpan is another structure defined in the System namespace that represents an elapsed time in units of 100-nanoseconds, which are the same units as the Ticks property of DateTime.
Substrcation and Addition of dates followed by the TimeSpan property.
DateTime dt1 = Convert.ToDateTime(DateTime.Now.Date.ToString("d"));
DateTime dt2 = Convert.ToDateTime(DateTime.Now.Date.AddDays(4).ToString("d"));
TimeSpan ts = dt2 - dt1;
Console.WriteLine(ts.Days);
No comments:
Post a Comment
Don't judge me like you know me.Don't talk to me if you don't like me. I am my own person and If you don't like that i don't give a f***