Display no of days between two calendars

55 Views Asked by At

I want to calculate the difference between two dates and display it on the text box when TODATE is selected.

Automatically difference between FROMDATE and TODATE will display.

Note: Those calendars are user defined controls.

1

There are 1 best solutions below

2
On

You can use DateTime.Subtract Method as below

TimeSpan span = TODATE.Subtract ( FROMDATE );
Console.WriteLine( "Time Difference (days): " + span.Days );