0

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

1

You can use DateTime.Subtract Method as below

TimeSpan span = TODATE.Subtract ( FROMDATE );
Console.WriteLine( "Time Difference (days): " + span.Days );
Sampath
  • 1,173
  • 18
  • 29
  • i want to write it when event is generated but i dont know how t ogenerate event for that – user3035605 Jan 24 '14 at 09:18
  • 2
    Use your calender controls Date selected event.. It is very useful post your code here..Otherwise people cannot give exact answers. – Sampath Jan 24 '14 at 09:23