Hi, I am designing a windows application which needs dates subtraction from date to end date and report should be generated. How to subtract two dates(format should be dd:mm:yy) by comparing the dates from database table?
Hi,
if you are using international Date it has operator - in itself so you just need to write :
DT1-DT2
and it gives you the answer in ‘TimeSpan’ value that you can call the tostring() method:
DateTime DT1=DateTime.Now, DT2=DateTime.Now;
TimeSpan d = DT1 - DT2;
Console.WriteLine(d.ToString());