Regarding Date Time Picker control in dot net

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?

Can any one help me please??

hello I am also having the same problem but in visual c++ and same .net framework. Can anybody help???

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());

or you can just use the days differences by:

System.Console.WriteLine(d.TotalDays);

Good Luck

Mahdi

This is not a place to ask these sort of questions. Please ask these questions at http://stackoverflow.com/ .

1 Like