Here you go........
no_of_days = DateDiff(d, DTPicker1.Value, DTPicker2.Value)
Above code is assuming that DTPicker1 is the starting date and DTPicker2 is the ending date...
eg; DTPicker1 = 15/03/2009
DTPicker2 = 20/03/2009
For above eg; the no_of_days will be 5
If DTPicker2 is less than DTPicker1 then you will get a negative answer. You can manipulate this as per your requirement or you can validate the user to select the dates as per your requirement.
Best Wishes Olive !!
|